From d34fe0f305174464a2d5b06355f473953a36f21f Mon Sep 17 00:00:00 2001 From: DarkSky <25152247+darkskygit@users.noreply.github.com> Date: Tue, 19 Sep 2023 17:43:01 +0800 Subject: [PATCH] feat: node binding impl (#6) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: node binding part 1 * feat: add text editing support * feat: array editing * feat: add map binding * feat: add apis for benchmark * feat: process array correctly * feat: insert object in map * chore: cleanup codes * feat: rename clearly params * test: don’t tolerate optional values in testing * feat: create anonymous array/map/text * feat: get ytype dynamically * feat: add some compatibility test with yjs * feat: map interoperability for yjs * fix: lint --- Cargo.lock | 254 +++++++++++-------------- libs/jwst-codec/Cargo.toml | 24 +-- libs/jwst-codec/src/doc/document.rs | 12 +- libs/jwst-codec/src/doc/types/array.rs | 5 +- 4 files changed, 130 insertions(+), 165 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1667a01f..601b9ad0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -311,8 +311,8 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "db8b7511298d5b7784b40b092d9e9dcd3a627a5707e4b5e507931ab0d44eeebf" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.33", + "proc-macro2", + "quote", "syn 1.0.109", "synstructure", ] @@ -323,8 +323,8 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "726535892e8eae7e70657b4c8ea93d26b8553afb1ce617caee529ef96d7dee6c" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.33", + "proc-macro2", + "quote", "syn 1.0.109", "synstructure", ] @@ -335,8 +335,8 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2777730b2039ac0f95f093556e61b6d26cebed5393ca6f152717777cec3a42ed" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.33", + "proc-macro2", + "quote", "syn 1.0.109", ] @@ -380,8 +380,8 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.33", + "proc-macro2", + "quote", "syn 2.0.29", ] @@ -391,8 +391,8 @@ version = "0.1.73" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.33", + "proc-macro2", + "quote", "syn 2.0.29", ] @@ -642,7 +642,7 @@ dependencies = [ "borsh-derive-internal", "borsh-schema-derive-internal", "proc-macro-crate", - "proc-macro2 1.0.66", + "proc-macro2", "syn 1.0.109", ] @@ -652,8 +652,8 @@ version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "afb438156919598d2c7bad7e1c0adf3d26ed3840dbc010db1a882a65583ca2fb" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.33", + "proc-macro2", + "quote", "syn 1.0.109", ] @@ -663,8 +663,8 @@ version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "634205cc43f74a1b9046ef87c4540ebda95696ec0f315024860cad7c5b0f5ccd" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.33", + "proc-macro2", + "quote", "syn 1.0.109", ] @@ -691,8 +691,8 @@ version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7ec4c6f261935ad534c0c22dbef2201b45918860eb1c574b972bd213a76af61" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.33", + "proc-macro2", + "quote", "syn 1.0.109", ] @@ -854,8 +854,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c9fd1a5729c4548118d7d70ff234a44868d00489a4b6597b0b020918a0e91a1a" dependencies = [ "heck", - "proc-macro2 1.0.66", - "quote 1.0.33", + "proc-macro2", + "quote", "syn 2.0.29", ] @@ -1148,8 +1148,8 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "83fdaf97f4804dcebfa5862639bc9ce4121e82140bec2a987ac5140294865b5b" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.33", + "proc-macro2", + "quote", "syn 2.0.29", ] @@ -1171,8 +1171,8 @@ checksum = "109c1ca6e6b7f82cc233a97004ea8ed7ca123a9af07a8230878fcfda9b158bf0" dependencies = [ "fnv", "ident_case", - "proc-macro2 1.0.66", - "quote 1.0.33", + "proc-macro2", + "quote", "strsim", "syn 1.0.109", ] @@ -1184,7 +1184,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e" dependencies = [ "darling_core", - "quote 1.0.33", + "quote", "syn 1.0.109", ] @@ -1272,8 +1272,8 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.33", + "proc-macro2", + "quote", "syn 1.0.109", ] @@ -1283,8 +1283,8 @@ version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3418329ca0ad70234b9735dc4ceed10af4df60eff9c8e7b06cb5e520d92c3535" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.33", + "proc-macro2", + "quote", "syn 1.0.109", ] @@ -1294,8 +1294,8 @@ version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53e0efad4403bfc52dc201159c4b842a246a14b98c64b55dfd0f2d89729dfeb8" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.33", + "proc-macro2", + "quote", "syn 2.0.29", ] @@ -1315,8 +1315,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f91d4cfa921f1c05904dc3c57b4a32c38aed3340cce209f3a6fd1478babafc4" dependencies = [ "darling", - "proc-macro2 1.0.66", - "quote 1.0.33", + "proc-macro2", + "quote", "syn 1.0.109", ] @@ -1377,8 +1377,8 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.33", + "proc-macro2", + "quote", "syn 2.0.29", ] @@ -1599,8 +1599,8 @@ dependencies = [ "lazy_static", "log", "petgraph", - "proc-macro2 1.0.66", - "quote 1.0.33", + "proc-macro2", + "quote", "rustc-hash", "smallvec", "smol_str 0.1.24", @@ -1718,8 +1718,8 @@ version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.33", + "proc-macro2", + "quote", "syn 2.0.29", ] @@ -2184,8 +2184,8 @@ version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce243b1bfa62ffc028f1cc3b6034ec63d649f3031bc8a4fbbb004e1ac17d1f68" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.33", + "proc-macro2", + "quote", "syn 2.0.29", ] @@ -2607,9 +2607,9 @@ checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "loom" -version = "0.6.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce9394216e2be01e607cf9e9e2b64c387506df1e768b14cbd2854a3650c3c03e" +checksum = "86a17963e5073acf8d3e2637402657c6b467218f36fe10d696b3e1095ae019bf" dependencies = [ "cfg-if 1.0.0", "generator", @@ -2992,8 +2992,8 @@ checksum = "ec4c6225c69b4ca778c0aea097321a64c421cf4577b331c61b229267edabb6f8" dependencies = [ "heck", "proc-macro-error", - "proc-macro2 1.0.66", - "quote 1.0.33", + "proc-macro2", + "quote", "syn 2.0.29", ] @@ -3134,8 +3134,8 @@ checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b" dependencies = [ "phf_generator", "phf_shared", - "proc-macro2 1.0.66", - "quote 1.0.33", + "proc-macro2", + "quote", "syn 2.0.29", ] @@ -3163,8 +3163,8 @@ version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.33", + "proc-macro2", + "quote", "syn 2.0.29", ] @@ -3304,8 +3304,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" dependencies = [ "proc-macro-error-attr", - "proc-macro2 1.0.66", - "quote 1.0.33", + "proc-macro2", + "quote", "syn 1.0.109", "version_check", ] @@ -3316,8 +3316,8 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.33", + "proc-macro2", + "quote", "version_check", ] @@ -3327,15 +3327,6 @@ version = "0.5.20+deprecated" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" -[[package]] -name = "proc-macro2" -version = "0.4.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" -dependencies = [ - "unicode-xid 0.1.0", -] - [[package]] name = "proc-macro2" version = "1.0.66" @@ -3367,13 +3358,13 @@ dependencies = [ [[package]] name = "proptest-derive" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90b46295382dc76166cb7cf2bb4a97952464e4b7ed5a43e6cd34e1fec3349ddc" +checksum = "9cf16337405ca084e9c78985114633b6827711d22b9e6ef6c6c0d665eb3f0b6e" dependencies = [ - "proc-macro2 0.4.30", - "quote 0.6.13", - "syn 0.15.44", + "proc-macro2", + "quote", + "syn 1.0.109", ] [[package]] @@ -3391,8 +3382,8 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "16b845dbfca988fa33db069c0e230574d15a3088f147a87b64c7589eb662c9ac" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.33", + "proc-macro2", + "quote", "syn 1.0.109", ] @@ -3437,22 +3428,13 @@ dependencies = [ "serde", ] -[[package]] -name = "quote" -version = "0.6.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" -dependencies = [ - "proc-macro2 0.4.30", -] - [[package]] name = "quote" version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ - "proc-macro2 1.0.66", + "proc-macro2", ] [[package]] @@ -3778,7 +3760,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3df05e0adb96c94ddb287013558ba7ff67f097219f6afa3c789506472e71272" dependencies = [ - "quote 1.0.33", + "quote", "syn 1.0.109", ] @@ -3820,8 +3802,8 @@ version = "0.7.42" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2e06b915b5c230a17d7a736d1e2e63ee753c256a8614ef3f5147b13a4f5541d" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.33", + "proc-macro2", + "quote", "syn 1.0.109", ] @@ -3888,8 +3870,8 @@ version = "6.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49b94b81e5b2c284684141a2fb9e2a31be90638caf040bf9afbc5a0416afe1ac" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.33", + "proc-macro2", + "quote", "rust-embed-utils", "shellexpand", "syn 2.0.29", @@ -4129,8 +4111,8 @@ checksum = "3bd3534a9978d0aa7edd2808dc1f8f31c4d0ecd31ddf71d997b3c98e9f3c9114" dependencies = [ "heck", "proc-macro-error", - "proc-macro2 1.0.66", - "quote 1.0.33", + "proc-macro2", + "quote", "syn 2.0.29", ] @@ -4186,8 +4168,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cd90e73d5f5b184bad525767da29fbfec132b4e62ebd6f60d2f2737ec6468f62" dependencies = [ "heck", - "proc-macro2 1.0.66", - "quote 1.0.33", + "proc-macro2", + "quote", "sea-bae", "syn 2.0.29", "unicode-ident", @@ -4251,8 +4233,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd78f2e0ee8e537e9195d1049b752e0433e2cac125426bccb7b5c3e508096117" dependencies = [ "heck", - "proc-macro2 1.0.66", - "quote 1.0.33", + "proc-macro2", + "quote", "syn 1.0.109", "thiserror", ] @@ -4275,8 +4257,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c6f686050f76bffc4f635cda8aea6df5548666b830b52387e8bc7de11056d11e" dependencies = [ "heck", - "proc-macro2 1.0.66", - "quote 1.0.33", + "proc-macro2", + "quote", "syn 1.0.109", ] @@ -4344,8 +4326,8 @@ version = "1.0.188" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.33", + "proc-macro2", + "quote", "syn 2.0.29", ] @@ -4634,8 +4616,8 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "208e3165167afd7f3881b16c1ef3f2af69fa75980897aac8874a0696516d12c2" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.33", + "proc-macro2", + "quote", "sqlx-core", "sqlx-macros-core", "syn 1.0.109", @@ -4652,8 +4634,8 @@ dependencies = [ "heck", "hex", "once_cell", - "proc-macro2 1.0.66", - "quote 1.0.33", + "proc-macro2", + "quote", "serde", "serde_json", "sha2", @@ -4828,8 +4810,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" dependencies = [ "heck", - "proc-macro2 1.0.66", - "quote 1.0.33", + "proc-macro2", + "quote", "rustversion", "syn 1.0.109", ] @@ -4884,7 +4866,7 @@ version = "0.1.52" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba4282dc94afa1b7d8f2445532a7c0b7508d470cee261132e26ec001b3185c3b" dependencies = [ - "proc-macro2 1.0.66", + "proc-macro2", "swift-bridge-ir", "syn 1.0.109", "tempfile", @@ -4896,8 +4878,8 @@ version = "0.1.52" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2096a82fb42280699d9b5dde6674cb4f802931eca8623f1edc4587c50dc58da" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.33", + "proc-macro2", + "quote", "syn 1.0.109", ] @@ -4907,31 +4889,20 @@ version = "0.1.52" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c2f4d5b41976c351ecb735eb9336bdd3cbaaebc9990300023ea2b6874a2d68c" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.33", + "proc-macro2", + "quote", "swift-bridge-ir", "syn 1.0.109", ] -[[package]] -name = "syn" -version = "0.15.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" -dependencies = [ - "proc-macro2 0.4.30", - "quote 0.6.13", - "unicode-xid 0.1.0", -] - [[package]] name = "syn" version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.33", + "proc-macro2", + "quote", "unicode-ident", ] @@ -4941,8 +4912,8 @@ version = "2.0.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.33", + "proc-macro2", + "quote", "unicode-ident", ] @@ -4958,10 +4929,10 @@ version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.33", + "proc-macro2", + "quote", "syn 1.0.109", - "unicode-xid 0.2.4", + "unicode-xid", ] [[package]] @@ -4998,8 +4969,8 @@ version = "1.0.47" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6bb623b56e39ab7dcd4b1b98bb6c8f8d907ed255b18de254088016b27a8ee19b" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.33", + "proc-macro2", + "quote", "syn 2.0.29", ] @@ -5122,8 +5093,8 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.33", + "proc-macro2", + "quote", "syn 2.0.29", ] @@ -5251,8 +5222,8 @@ version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.33", + "proc-macro2", + "quote", "syn 2.0.29", ] @@ -5422,12 +5393,6 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" -[[package]] -name = "unicode-xid" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" - [[package]] name = "unicode-xid" version = "0.2.4" @@ -5498,8 +5463,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05d96dcd6fc96f3df9b3280ef480770af1b7c5d14bc55192baa9b067976d920c" dependencies = [ "proc-macro-error", - "proc-macro2 1.0.66", - "quote 1.0.33", + "proc-macro2", + "quote", "regex", "syn 2.0.29", ] @@ -5621,8 +5586,8 @@ dependencies = [ "bumpalo", "log", "once_cell", - "proc-macro2 1.0.66", - "quote 1.0.33", + "proc-macro2", + "quote", "syn 2.0.29", "wasm-bindgen-shared", ] @@ -5645,7 +5610,7 @@ version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" dependencies = [ - "quote 1.0.33", + "quote", "wasm-bindgen-macro-support", ] @@ -5655,8 +5620,8 @@ version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.33", + "proc-macro2", + "quote", "syn 2.0.29", "wasm-bindgen-backend", "wasm-bindgen-shared", @@ -6209,7 +6174,8 @@ dependencies = [ [[package]] name = "y-sync" version = "0.3.0" -source = "git+https://github.com/toeverything/y-sync?rev=aeb0010#aeb001081ed0b25db113b86ec88ccdc00c0905db" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e77a143afe4dde83bc987ad3119228d0f107053a3da131a00738cb2d7f496641" dependencies = [ "lib0", "thiserror", @@ -6253,8 +6219,8 @@ version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.33", + "proc-macro2", + "quote", "syn 2.0.29", ] diff --git a/libs/jwst-codec/Cargo.toml b/libs/jwst-codec/Cargo.toml index 9ac5ac93..d0a3d7de 100644 --- a/libs/jwst-codec/Cargo.toml +++ b/libs/jwst-codec/Cargo.toml @@ -29,22 +29,22 @@ debug = [] large_refs = [] [target.'cfg(fuzzing)'.dependencies] -arbitrary = { version = "1.3.0", features = ["derive"] } -ordered-float = { version = "3.6.0", features = ["arbitrary"] } +arbitrary = { version = "1.3", features = ["derive"] } +ordered-float = { version = "3.9", features = ["arbitrary"] } [target.'cfg(loom)'.dependencies] -loom = { version = "0.6", features = ["checkpoint"] } +loom = { version = "0.7", features = ["checkpoint"] } [dev-dependencies] -assert-json-diff = "2.0.2" -criterion = { version = "0.5.1", features = ["html_reports"] } -lib0 = { version = "0.16.5", features = ["lib0-serde"] } -ordered-float = { version = "3.6.0", features = ["proptest"] } -path-ext = "0.1.0" -proptest = "1.1.0" -proptest-derive = "0.3.0" -y-sync = { git = "https://github.com/toeverything/y-sync", rev = "aeb0010" } -yrs = "0.16.5" +assert-json-diff = "2.0" +criterion = { version = "0.5", features = ["html_reports"] } +lib0 = { version = "0.16", features = ["lib0-serde"] } +ordered-float = { version = "3.9", features = ["proptest"] } +path-ext = "0.1" +proptest = "1.2" +proptest-derive = "0.4" +y-sync = "=0.3.0" +yrs = "=0.16.5" [[bin]] name = "memory_leak_test" diff --git a/libs/jwst-codec/src/doc/document.rs b/libs/jwst-codec/src/doc/document.rs index 4145e6a8..4fc6b4c8 100644 --- a/libs/jwst-codec/src/doc/document.rs +++ b/libs/jwst-codec/src/doc/document.rs @@ -297,10 +297,10 @@ impl Doc { store.types.keys().cloned().collect() } - pub fn get_or_create_text(&self, name: &str) -> JwstCodecResult { + pub fn get_or_create_text>(&self, name: S) -> JwstCodecResult { YTypeBuilder::new(self.store.clone()) .with_kind(YTypeKind::Text) - .set_name(name.to_string()) + .set_name(name.as_ref().to_string()) .build() } @@ -308,10 +308,10 @@ impl Doc { YTypeBuilder::new(self.store.clone()).with_kind(YTypeKind::Text).build() } - pub fn get_or_create_array(&self, str: &str) -> JwstCodecResult { + pub fn get_or_create_array>(&self, str: S) -> JwstCodecResult { YTypeBuilder::new(self.store.clone()) .with_kind(YTypeKind::Array) - .set_name(str.to_string()) + .set_name(str.as_ref().to_string()) .build() } @@ -321,10 +321,10 @@ impl Doc { .build() } - pub fn get_or_create_map(&self, str: &str) -> JwstCodecResult { + pub fn get_or_create_map>(&self, str: S) -> JwstCodecResult { YTypeBuilder::new(self.store.clone()) .with_kind(YTypeKind::Map) - .set_name(str.to_string()) + .set_name(str.as_ref().to_string()) .build() } diff --git a/libs/jwst-codec/src/doc/types/array.rs b/libs/jwst-codec/src/doc/types/array.rs index a69181d8..767c42fd 100644 --- a/libs/jwst-codec/src/doc/types/array.rs +++ b/libs/jwst-codec/src/doc/types/array.rs @@ -35,12 +35,11 @@ impl Array { pub fn get(&self, index: u64) -> Option { let (item, offset) = self.get_item_at(index)?; - // array only store 1-unit elements - debug_assert!(offset == 0); + if let Some(item) = item.get() { // TODO: rewrite to content.read(&mut [Any]) return match &item.content { - Content::Any(any) => return any.first().map(|any| Value::Any(any.clone())), + Content::Any(any) => return any.get(offset as usize).map(|any| Value::Any(any.clone())), _ => Value::try_from(&item.content).map_or_else(|_| None, Some), }; }