From 3e3e70d529d8c7d7c4d7bc4fefc9f109393b9245 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:43 +0200 Subject: Merging upstream version 1.69.0+dfsg1. Signed-off-by: Daniel Baumann --- vendor/zerovec/.cargo-checksum.json | 2 +- vendor/zerovec/Cargo.lock | 327 ++++++++------------------------ vendor/zerovec/Cargo.toml | 29 ++- vendor/zerovec/README.md | 2 +- vendor/zerovec/benches/vzv.rs | 8 +- vendor/zerovec/benches/zeromap.rs | 20 +- vendor/zerovec/src/flexzerovec/serde.rs | 8 +- vendor/zerovec/src/flexzerovec/slice.rs | 8 +- vendor/zerovec/src/lib.rs | 9 +- vendor/zerovec/src/map/borrowed.rs | 14 +- vendor/zerovec/src/map/map.rs | 4 +- vendor/zerovec/src/map/serde.rs | 8 +- vendor/zerovec/src/map2d/borrowed.rs | 9 +- vendor/zerovec/src/map2d/cursor.rs | 70 ++++++- vendor/zerovec/src/map2d/map.rs | 12 +- vendor/zerovec/src/map2d/serde.rs | 8 +- vendor/zerovec/src/ule/mod.rs | 6 + vendor/zerovec/src/ule/option.rs | 2 +- vendor/zerovec/src/ule/plain.rs | 19 +- vendor/zerovec/src/ule/unvalidated.rs | 10 +- vendor/zerovec/src/varzerovec/serde.rs | 8 +- vendor/zerovec/src/varzerovec/slice.rs | 28 ++- vendor/zerovec/src/varzerovec/vec.rs | 16 +- vendor/zerovec/src/yoke_impls.rs | 14 +- vendor/zerovec/src/zerovec/mod.rs | 7 +- vendor/zerovec/src/zerovec/serde.rs | 10 +- vendor/zerovec/src/zerovec/slice.rs | 30 ++- 27 files changed, 288 insertions(+), 400 deletions(-) (limited to 'vendor/zerovec') diff --git a/vendor/zerovec/.cargo-checksum.json b/vendor/zerovec/.cargo-checksum.json index 4e45eb54b..fbf1303f2 100644 --- a/vendor/zerovec/.cargo-checksum.json +++ b/vendor/zerovec/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"Cargo.lock":"4a4e071e00c3386a3870ffdc70c8ff156025f1b25b01f136bbc98e63cffe9525","Cargo.toml":"25e11edaad953215cca394ea63f181dbe0ce0105bd0c1b2439830f613c2b4e2a","LICENSE":"4ad7541d66a407234e2c84902124cef325c29f3e966353efdb800bedb8b8da21","README.md":"95660d3a679736a3308aaf2f43728c3052ed9dc93fdec63de163ca90de531a33","benches/testdata/large_hashmap.postcard":"f327c7c25ee0ac05e0c2052ee38b76c77968240e084477b0f703b5a0bc6f4ccf","benches/testdata/large_zeromap.postcard":"d0f15324e7e3bf8318e87fefad9249c0bda8e8d555c220f81467e0a90270059a","benches/vzv.rs":"eb816f36a3fa29dc94e44d2f78bdb62d07fdf58e72054e24645d3da5091145fa","benches/zeromap.rs":"4833d3bddfc80c20748ca8513059f2ed8029fb9dc2267bf332a0659e895d77fa","benches/zerovec.rs":"e32e380e653c62b1f344cb7be917016b739b2c4e722d62193aa3fa45908e77c0","benches/zerovec_iai.rs":"13028e4f1d85bad3ee5e5b783360b7ea247dd5de233d104b91ce46d19bf5765a","benches/zerovec_serde.rs":"7ed92aaaf5981755b4f02f366e1a0434b49a4a6ffa0945c96663626d787db070","examples/zv_serde.rs":"d7fd49aba0400636c1af16ac1cbf28f8d74c61a94ee7b318dcaf23213acec1e8","src/error.rs":"19ca9ab31b2b16cb0f604ed5f4a43c18796672bfd498af334b47aad76059b143","src/flexzerovec/databake.rs":"a32503b5aa4c3e4d5627e91ab0ec0ffbc40983dab93ba9062e4672ee1e7d0335","src/flexzerovec/mod.rs":"647678116fcf0321463b3451462920f7c517f4cf6c8a57f4f7b13f5248c8b9b0","src/flexzerovec/owned.rs":"dc6ea4cdc1b147f9e64f89281a0315fa729d134617a694646463013314e3ab46","src/flexzerovec/serde.rs":"641821a6753477498d28126bdee10a0a625deb92b39ec8c2d3c2d432d9cb9512","src/flexzerovec/slice.rs":"91dd96c895e5da9d88cff9905deece3baef775282602e9a6f0d368ac6139e2cb","src/flexzerovec/vec.rs":"103b72950ae6be8d1fd4c8db07460c2b6203c87927b722807d329177e8d41d48","src/lib.rs":"c4841809466cff4fc33345638aa1c41500b5f76ad6c93990600176b83f75693d","src/map/borrowed.rs":"56a5d2a305227b2e748b2c7172561ffc7ca68302039b21947cc68cf7c6e7c02e","src/map/databake.rs":"29afbc7882f30ce63596e2cb98f589f24bd76919d7062a18f02a5df630f31dce","src/map/kv.rs":"03f3745df8d61ff399b66d32ba1ac9a7ee298ca00dfb463c3ea8d81c746e9d41","src/map/map.rs":"24094239ef0281241c080f6d80375eea8aacbb3ac303a1bd76d7845a8bd70419","src/map/mod.rs":"4961ad14522fcef16b1aad804d9559c0a5eb2582fdd163bf76f9629cb765b6c4","src/map/serde.rs":"e5ee812805788672c40bc912ed70b241328a4098ecc1acea332b92456d082f9b","src/map/serde_helpers.rs":"72787005972b93e49b9dc17aa47d30699364e6da9dc95aadb820ce58e4bf5c54","src/map/vecs.rs":"86c9b04a92b7a918af3653e05fbf622fbb1b52b0a4307a5dadef070882778233","src/map2d/borrowed.rs":"cfbed2709cf0dc508c2da1f6a9c49b6e22deacd19679e296af4e44da3052fe07","src/map2d/cursor.rs":"c19b3d0b13b3cc5d0b3f2fbc246ed511f8ec9ec77a83a2be1aabea0d09c8d3a7","src/map2d/databake.rs":"c9451511566f9589236789c8dc5fbb32112a8324bd9b4bae75cd3be05b42962c","src/map2d/map.rs":"663dbb62f3fe003d5d5587955f693b9e3ee55ac1d366487df45bd302aa5855e7","src/map2d/mod.rs":"80beae7a263f1fe39c9a06d287c9150480fe3ed43397c2a7475a50ee2b2fd37f","src/map2d/serde.rs":"ff25b5b5f40b8bc438f18a96d646c22b0d670a89a3fe822a38b573ce7dc7fc32","src/samples.rs":"a3a2571da3a911f20bad9179441ba2676f4e5cf1ca2408a4dc6111cadbcef6cd","src/ule/chars.rs":"f8b32dd407dcc05b7d416c361d7a7c2166708d1edaa0559c829bd449dcb0a7aa","src/ule/custom.rs":"49604e3c1d67836a7e783b91ef2bfeaddfbe4758d6c5614ce3cd1ae60cfdb5ea","src/ule/encode.rs":"91a11ff2f2ddf3dffc1411343e286249e63b0cfa076d6c41f83ea952c527b014","src/ule/mod.rs":"5550fd0e3c59562bc1e6b417a5c61882d776b906f83befd78608f448323b930c","src/ule/multi.rs":"ed470e4b62c6233ee81b33f473eccf1e8db75db52275ec371cdc2b477478d959","src/ule/niche.rs":"1c64b5862cd7f1cd384160012a39414a335ea1f36119bb5fc56ac7cb5e050d8b","src/ule/option.rs":"0b1ba426e665f7a7fd67e736bf8552a86859b30dc83c35751156f18133e1cf99","src/ule/plain.rs":"acd4507776963459228b5425866e92e7363124f48f96abd28ba99a7c6245709f","src/ule/slices.rs":"a7638535898b39be9f489f3ff9a2140b5334113c2ddc48c4fae2bc8b86efbd14","src/ule/tuple.rs":"498f6863b1af1e6b2c655e77df53cf9818613c60189b2ce1369850e388d09e3c","src/ule/unvalidated.rs":"26b937c6b44afbd94f0e2397e29db820c0eaa7c116c427304741957e825d5893","src/varzerovec/components.rs":"6810dc5cf007572a4e22831f55822f79f720e29309c33b1c546057fd5dedfb61","src/varzerovec/databake.rs":"819c6e511e4256cb0c1e3fbf2bad521472f133355ce0cc12e46c97ec2f71dbb2","src/varzerovec/mod.rs":"c7aaaf571f7406e666d877920966a2e39373b5cf6a038cb31dbe4192b2e75d4d","src/varzerovec/owned.rs":"0aac2dd14fde57c22f4b5a943756ee90001d824d04682336782700c1f7efd272","src/varzerovec/serde.rs":"e008df1773393340abdf1c1cc80ab9035881b5f5de1e48bf4edde0963198bde7","src/varzerovec/slice.rs":"6e03824809aa1d5dcae20844f7d40c2521a824774185fc82b23ed9327b0a6468","src/varzerovec/vec.rs":"49e66dc827ff8fad20dbe86a92239f2131d16c41d7ca6e56f636325a3ff576c6","src/yoke_impls.rs":"84ef42aa194dd56502dba63283652b3783a34b3069211920e5587256c62c4abe","src/zerofrom_impls.rs":"a3e02b3473cf6deba8c0e9dd815ad7db7ced75e7ad3b353597faea189b63c1d5","src/zerovec/databake.rs":"8d1f857fa89b8b64c7a5e2b2ba84d06b266b3cf6c716bc383c9004a6602c5d43","src/zerovec/mod.rs":"3c52bd0f02a92a2c1e8226b26db82c72bc5fa66ded67e1cd6fc05ac3caa1913a","src/zerovec/serde.rs":"873e6e07e4efda0643d77c920067c4b5a30e188da5a176d623b785bbd2980bab","src/zerovec/slice.rs":"e969657302ec0ab822bf6abbb46cce5a4e53ac49e4f7f1db5ed10962926c7adf"},"package":"b9d919a74c17749ccb17beaf6405562e413cd94e98ba52ca1e64bbe7eefbd8b8"} \ No newline at end of file +{"files":{"Cargo.lock":"ab1a55fa6a0e30a1509d639a0a0c77f500470ddaf6b34a1a9e83ecd7931b9648","Cargo.toml":"977eb85b9a33c508f31264b230c72c66cbf1fd11de723ac79153c1b4f3080b58","LICENSE":"4ad7541d66a407234e2c84902124cef325c29f3e966353efdb800bedb8b8da21","README.md":"6f1174cdbf3467cb6f02e6f715bf105b833cea392995c18ed28cda871c4e15fa","benches/testdata/large_hashmap.postcard":"f327c7c25ee0ac05e0c2052ee38b76c77968240e084477b0f703b5a0bc6f4ccf","benches/testdata/large_zeromap.postcard":"d0f15324e7e3bf8318e87fefad9249c0bda8e8d555c220f81467e0a90270059a","benches/vzv.rs":"2b0de82b4a40d45151e7faa2d18cfcb65351059f3f391dd64f031c565212c561","benches/zeromap.rs":"eb001722b4158a405610d2cb8aa4ccbb53d5e29ea0898639912cf7d55598de6c","benches/zerovec.rs":"e32e380e653c62b1f344cb7be917016b739b2c4e722d62193aa3fa45908e77c0","benches/zerovec_iai.rs":"13028e4f1d85bad3ee5e5b783360b7ea247dd5de233d104b91ce46d19bf5765a","benches/zerovec_serde.rs":"7ed92aaaf5981755b4f02f366e1a0434b49a4a6ffa0945c96663626d787db070","examples/zv_serde.rs":"d7fd49aba0400636c1af16ac1cbf28f8d74c61a94ee7b318dcaf23213acec1e8","src/error.rs":"19ca9ab31b2b16cb0f604ed5f4a43c18796672bfd498af334b47aad76059b143","src/flexzerovec/databake.rs":"a32503b5aa4c3e4d5627e91ab0ec0ffbc40983dab93ba9062e4672ee1e7d0335","src/flexzerovec/mod.rs":"647678116fcf0321463b3451462920f7c517f4cf6c8a57f4f7b13f5248c8b9b0","src/flexzerovec/owned.rs":"dc6ea4cdc1b147f9e64f89281a0315fa729d134617a694646463013314e3ab46","src/flexzerovec/serde.rs":"a0c7a8fcf5ef06f5ea44cbfb89cac47f173c7150082d0cd745a457de3d375b4f","src/flexzerovec/slice.rs":"6c115b32011d127bb59f1818e7d1061a0786a8b2d4d7d174f43acf02189d73eb","src/flexzerovec/vec.rs":"103b72950ae6be8d1fd4c8db07460c2b6203c87927b722807d329177e8d41d48","src/lib.rs":"0e91c4fb200f27665b509796fd4d0672578d140502721a645fe068f23d6aa2bd","src/map/borrowed.rs":"abd5886b384075780498ddc39300eeeda0bc520bdee1cea43096f50a9ac42f07","src/map/databake.rs":"29afbc7882f30ce63596e2cb98f589f24bd76919d7062a18f02a5df630f31dce","src/map/kv.rs":"03f3745df8d61ff399b66d32ba1ac9a7ee298ca00dfb463c3ea8d81c746e9d41","src/map/map.rs":"d0298742d6f46ca39f3ebc9f0761ab2997523da40df5c9ea9515a8584b266c50","src/map/mod.rs":"4961ad14522fcef16b1aad804d9559c0a5eb2582fdd163bf76f9629cb765b6c4","src/map/serde.rs":"3bed09076a45774c65a8116dd21e72413f1657ed569fe32c4abb48e979fd3144","src/map/serde_helpers.rs":"72787005972b93e49b9dc17aa47d30699364e6da9dc95aadb820ce58e4bf5c54","src/map/vecs.rs":"86c9b04a92b7a918af3653e05fbf622fbb1b52b0a4307a5dadef070882778233","src/map2d/borrowed.rs":"f2a1f927c6d0942fd8ad183de24a32a2b1450f2f747cb328862163f6d9505ebb","src/map2d/cursor.rs":"e4447e7b5869e895b852124443151918bff5fe8cfb5207acfe5ff7b57b56bfdf","src/map2d/databake.rs":"c9451511566f9589236789c8dc5fbb32112a8324bd9b4bae75cd3be05b42962c","src/map2d/map.rs":"358408292de4c06e82f6eebf2f014d3737241f383d8fc3c946bfb44da1071b3b","src/map2d/mod.rs":"80beae7a263f1fe39c9a06d287c9150480fe3ed43397c2a7475a50ee2b2fd37f","src/map2d/serde.rs":"c4f32f25bc6e850eccd677e5b0cf9cd796df71855b80459893c0323ad7901bd5","src/samples.rs":"a3a2571da3a911f20bad9179441ba2676f4e5cf1ca2408a4dc6111cadbcef6cd","src/ule/chars.rs":"f8b32dd407dcc05b7d416c361d7a7c2166708d1edaa0559c829bd449dcb0a7aa","src/ule/custom.rs":"49604e3c1d67836a7e783b91ef2bfeaddfbe4758d6c5614ce3cd1ae60cfdb5ea","src/ule/encode.rs":"91a11ff2f2ddf3dffc1411343e286249e63b0cfa076d6c41f83ea952c527b014","src/ule/mod.rs":"4a71652bb0d771aee247518a1c50e72bdea12fd884feaf7f55385808047069ef","src/ule/multi.rs":"ed470e4b62c6233ee81b33f473eccf1e8db75db52275ec371cdc2b477478d959","src/ule/niche.rs":"1c64b5862cd7f1cd384160012a39414a335ea1f36119bb5fc56ac7cb5e050d8b","src/ule/option.rs":"32979913da36452a27951e3f073494006c26f570af5733a1b0ce5a75427300b4","src/ule/plain.rs":"27f47ce32cbcb62ef088dbd60dbb9d79c2d54e1a3ff024cdc863362542b74336","src/ule/slices.rs":"a7638535898b39be9f489f3ff9a2140b5334113c2ddc48c4fae2bc8b86efbd14","src/ule/tuple.rs":"498f6863b1af1e6b2c655e77df53cf9818613c60189b2ce1369850e388d09e3c","src/ule/unvalidated.rs":"a92f2e94ba8bb50b6f63914549501653aa0622b6d6810824c271afe37edc367a","src/varzerovec/components.rs":"6810dc5cf007572a4e22831f55822f79f720e29309c33b1c546057fd5dedfb61","src/varzerovec/databake.rs":"819c6e511e4256cb0c1e3fbf2bad521472f133355ce0cc12e46c97ec2f71dbb2","src/varzerovec/mod.rs":"c7aaaf571f7406e666d877920966a2e39373b5cf6a038cb31dbe4192b2e75d4d","src/varzerovec/owned.rs":"0aac2dd14fde57c22f4b5a943756ee90001d824d04682336782700c1f7efd272","src/varzerovec/serde.rs":"efb06a8b139dffc6d0534f7e0de4dc39b82ed224481f25bc5dea14d0159b5208","src/varzerovec/slice.rs":"4524631711cfa9ac530f116fc2801526d1d14e7a21ead10aa2bfb3f4de298cac","src/varzerovec/vec.rs":"6557bc9a146cc6563a17a62c3e8d38b68ba1451ff99d5741d0bbdb5b67703573","src/yoke_impls.rs":"3d2486b99eda20cc2c9dd6360d5589f95e6b2bfce847c3637b91134836f73566","src/zerofrom_impls.rs":"a3e02b3473cf6deba8c0e9dd815ad7db7ced75e7ad3b353597faea189b63c1d5","src/zerovec/databake.rs":"8d1f857fa89b8b64c7a5e2b2ba84d06b266b3cf6c716bc383c9004a6602c5d43","src/zerovec/mod.rs":"777a70ac94f0c80869f4576d8aaad5c96083a94eb3c3db86ebc98b4805b4a0ff","src/zerovec/serde.rs":"3a088c88732ffc0814a09777f89a83857e948c1eff6dfc2d1eb6bad5ece3976a","src/zerovec/slice.rs":"49c29036ddc9efee1fc327152a78e9d20f8f8174a71468dfe6d68a6437882419"},"package":"154df60c74c4a844bc04a53cef4fc18a909d3ea07e19f5225eaba86209da3aa6"} \ No newline at end of file diff --git a/vendor/zerovec/Cargo.lock b/vendor/zerovec/Cargo.lock index 59e492118..f722be128 100644 --- a/vendor/zerovec/Cargo.lock +++ b/vendor/zerovec/Cargo.lock @@ -2,20 +2,11 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "aho-corasick" -version = "0.7.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e" -dependencies = [ - "memchr", -] - [[package]] name = "atomic-polyfill" -version = "0.1.10" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c041a8d9751a520ee19656232a18971f18946a7900f1520ee4400002244dd89" +checksum = "e3ff7eb3f316534d83a8a2c3d1674ace8a5a71198eba31e2e2b597833f699b28" dependencies = [ "critical-section", ] @@ -26,7 +17,7 @@ version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ - "hermit-abi", + "hermit-abi 0.1.19", "libc", "winapi", ] @@ -37,21 +28,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" -[[package]] -name = "bare-metal" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5deb64efa5bd81e31fcd1938615a6d98c82eafcbcd787162b6f63b91d6bac5b3" -dependencies = [ - "rustc_version 0.2.3", -] - -[[package]] -name = "bare-metal" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8fe8f5a8a398345e52358e18ff07cc17a568fbca5c6f73873d3a62056309603" - [[package]] name = "bincode" version = "1.3.3" @@ -61,18 +37,6 @@ dependencies = [ "serde", ] -[[package]] -name = "bit_field" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcb6dd1c2376d2e096796e234a70e17e94cc2d5d54ff8ce42b28cef1d0d359a4" - -[[package]] -name = "bitfield" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46afbd2983a5d5a7bd740ccb198caf5b82f45c40c09c0eed36052d91cb92e719" - [[package]] name = "bitflags" version = "1.3.2" @@ -93,9 +57,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.11.0" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1ad822118d20d2c234f427000d5acc36eabe1e29a348c89b63dd60b13f28e5d" +checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" [[package]] name = "byteorder" @@ -132,18 +96,6 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15" -[[package]] -name = "cortex-m" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70858629a458fdfd39f9675c4dc309411f2a3f83bede76988d81bf1a0ecee9e0" -dependencies = [ - "bare-metal 0.2.5", - "bitfield", - "embedded-hal", - "volatile-register", -] - [[package]] name = "criterion" version = "0.3.6" @@ -182,15 +134,9 @@ dependencies = [ [[package]] name = "critical-section" -version = "0.2.7" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95da181745b56d4bd339530ec393508910c909c784e8962d15d722bacf0bcbcd" -dependencies = [ - "bare-metal 1.0.0", - "cfg-if", - "cortex-m", - "riscv", -] +checksum = "6548a0ad5d2549e111e1f6a11a6c2e2d00ce6a3dafe22948d67c2b443f775e52" [[package]] name = "crossbeam-channel" @@ -215,26 +161,24 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.10" +version = "0.9.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "045ebe27666471bb549370b4b0b3e51b07f56325befa4284db65fc89c02511b1" +checksum = "01a9af1f4c2ef74bb8aa1f7e19706bc72d03598c8a570bb5de72243c7a9d9d5a" dependencies = [ "autocfg", "cfg-if", "crossbeam-utils", "memoffset", - "once_cell", "scopeguard", ] [[package]] name = "crossbeam-utils" -version = "0.8.11" +version = "0.8.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51887d4adc7b564537b15adcfb307936f8075dfcd5f00dde9a9f1d29383682bc" +checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f" dependencies = [ "cfg-if", - "once_cell", ] [[package]] @@ -261,9 +205,9 @@ dependencies = [ [[package]] name = "databake" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c87777d6d7bde863ba217aa87521dc857239de1f36d66aac46fd173fb0495858" +checksum = "df626c4717e455cd7a70a82c4358630554a07e4341f86dd095c625f1474a2857" dependencies = [ "databake-derive", "proc-macro2", @@ -273,9 +217,9 @@ dependencies = [ [[package]] name = "databake-derive" -version = "0.1.1" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "905c7a060fc0c84c0452d97473b1177dd7a5cbc7670cfbae4a7fe22e42f6432e" +checksum = "be51a53c468489ae1ef0efa9f6b10706f426c0dde06d66122ffef1f0c51e87dc" dependencies = [ "proc-macro2", "quote", @@ -289,21 +233,11 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" -[[package]] -name = "embedded-hal" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35949884794ad573cf46071e41c9b60efb0cb311e3ca01f7af807af1debc66ff" -dependencies = [ - "nb 0.1.3", - "void", -] - [[package]] name = "getrandom" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" +checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" dependencies = [ "cfg-if", "js-sys", @@ -335,7 +269,7 @@ checksum = "db04bc24a18b9ea980628ecf00e6c0264f3c1426dac36c00cb49b6fbad8b0743" dependencies = [ "atomic-polyfill", "hash32", - "rustc_version 0.4.0", + "rustc_version", "serde", "spin", "stable_deref_trait", @@ -351,16 +285,19 @@ dependencies = [ ] [[package]] -name = "iai" -version = "0.1.1" +name = "hermit-abi" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71a816c97c42258aa5834d07590b718b4c9a598944cd39a52dc25b351185d678" +checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" +dependencies = [ + "libc", +] [[package]] -name = "icu_benchmark_macros" -version = "0.7.0" +name = "iai" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c867656f2d9c90b13709ac88e710a9d6afe33998c1dfa22384bab8804e8b3d4" +checksum = "71a816c97c42258aa5834d07590b718b4c9a598944cd39a52dc25b351185d678" [[package]] name = "itertools" @@ -379,9 +316,9 @@ checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" [[package]] name = "itoa" -version = "1.0.3" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8af84674fe1f223a982c933a0ee1086ac4d4052aa0fb8060c12c6ad838e754" +checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" [[package]] name = "js-sys" @@ -400,15 +337,15 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.133" +version = "0.2.139" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0f80d65747a3e43d1596c7c5492d95d5edddaabd45a7fcdb02b95f644164966" +checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" [[package]] name = "libm" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "292a948cd991e376cf75541fe5b97a1081d713c618b4f1b9500f8844e49eb565" +checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb" [[package]] name = "lock_api" @@ -437,28 +374,13 @@ checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "memoffset" -version = "0.6.5" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" +checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" dependencies = [ "autocfg", ] -[[package]] -name = "nb" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f" -dependencies = [ - "nb 1.0.0", -] - -[[package]] -name = "nb" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "546c37ac5d9e56f55e73b677106873d9d9f5190605e41a856503623648488cae" - [[package]] name = "num-traits" version = "0.2.15" @@ -471,19 +393,19 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.13.1" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" +checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" dependencies = [ - "hermit-abi", + "hermit-abi 0.2.6", "libc", ] [[package]] name = "once_cell" -version = "1.15.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e82dad04139b71a90c080c8463fe0dc7902db5192d939bd0950f074d014339e1" +checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" [[package]] name = "oorandom" @@ -532,24 +454,24 @@ dependencies = [ [[package]] name = "ppv-lite86" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.44" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bd7356a8122b6c4a24a82b278680c73357984ca2fc79a0f9fa6dea7dced7c58" +checksum = "6ef7d57beacfaf2d8aee5937dab7b7f28de3cb8b1828479bb5de2a7106f2bae2" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.21" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" +checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" dependencies = [ "proc-macro2", ] @@ -605,21 +527,19 @@ dependencies = [ [[package]] name = "rayon" -version = "1.5.3" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd99e5772ead8baa5215278c9b15bf92087709e9c1b2d1f97cdb5a183c933a7d" +checksum = "6db3a213adf02b3bcfd2d3846bb41cb22857d131789e01df434fb7e7bc0759b7" dependencies = [ - "autocfg", - "crossbeam-deque", "either", "rayon-core", ] [[package]] name = "rayon-core" -version = "1.9.3" +version = "1.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "258bcdb5ac6dad48491bb2992db6b7cf74878b0384908af124823d118c99683f" +checksum = "356a0625f1954f730c0201cdab48611198dc6ce21f4acff55089b5a78e6e835b" dependencies = [ "crossbeam-channel", "crossbeam-deque", @@ -629,12 +549,10 @@ dependencies = [ [[package]] name = "regex" -version = "1.6.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" +checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733" dependencies = [ - "aho-corasick", - "memchr", "regex-syntax", ] @@ -646,39 +564,9 @@ checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" [[package]] name = "regex-syntax" -version = "0.6.27" +version = "0.6.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" - -[[package]] -name = "riscv" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6907ccdd7a31012b70faf2af85cd9e5ba97657cc3987c4f13f8e4d2c2a088aba" -dependencies = [ - "bare-metal 1.0.0", - "bit_field", - "riscv-target", -] - -[[package]] -name = "riscv-target" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88aa938cda42a0cf62a20cfe8d139ff1af20c2e681212b5b34adb5a58333f222" -dependencies = [ - "lazy_static", - "regex", -] - -[[package]] -name = "rustc_version" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -dependencies = [ - "semver 0.9.0", -] +checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" [[package]] name = "rustc_version" @@ -686,14 +574,14 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver 1.0.14", + "semver", ] [[package]] name = "ryu" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" +checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" [[package]] name = "same-file" @@ -712,30 +600,15 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "semver" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -dependencies = [ - "semver-parser", -] - -[[package]] -name = "semver" -version = "1.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4" - -[[package]] -name = "semver-parser" -version = "0.7.0" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" +checksum = "58bc9567378fc7690d6b2addae4e60ac2eeea07becb2c64b9f218b53865cba2a" [[package]] name = "serde" -version = "1.0.145" +version = "1.0.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "728eb6351430bccb993660dfffc5a72f91ccc1295abaa8ce19b27ebe4f75568b" +checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" dependencies = [ "serde_derive", ] @@ -752,9 +625,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.145" +version = "1.0.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81fa1584d3d1bcacd84c277a0dfe21f5b0f6accf4a23d04d4c6d61f1af522b4c" +checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" dependencies = [ "proc-macro2", "quote", @@ -763,11 +636,11 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.85" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e55a28e3aaef9d5ce0506d0a14dbba8054ddc7e499ef522dd8b26859ec9d4a44" +checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883" dependencies = [ - "itoa 1.0.3", + "itoa 1.0.5", "ryu", "serde", ] @@ -789,9 +662,9 @@ checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" [[package]] name = "syn" -version = "1.0.101" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e90cde112c4b9690b8cbe810cba9ddd8bc1d7472e2cae317b69e9438c1cba7d2" +checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" dependencies = [ "proc-macro2", "quote", @@ -831,9 +704,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.4" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcc811dc4066ac62f84f11307873c4850cb653bfa9b1719cee2bd2204a4bc5dd" +checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" [[package]] name = "unicode-width" @@ -847,27 +720,6 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" -[[package]] -name = "vcell" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77439c1b53d2303b20d9459b1ade71a83c716e3f9c34f3228c00e6f185d6c002" - -[[package]] -name = "void" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" - -[[package]] -name = "volatile-register" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ee8f19f9d74293faf70901bc20ad067dc1ad390d2cbf1e3f75f721ffee908b6" -dependencies = [ - "vcell", -] - [[package]] name = "walkdir" version = "2.3.2" @@ -982,59 +834,30 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "yoke" -version = "0.6.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "620cda8a59740b1e9313dad314848c6ffe15792c38cc4ac2def245ee77a6cae2" +checksum = "222180af14a6b54ef2c33493c1eff77ae95a3687a21b243e752624006fb8f26e" dependencies = [ "serde", "stable_deref_trait", - "yoke-derive", "zerofrom", ] -[[package]] -name = "yoke-derive" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58c2c5bb7c929b85c1b9ec69091b0d835f0878b4fd9eb67973b25936e06c4374" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", -] - [[package]] name = "zerofrom" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "79e9355fccf72b04b7deaa99ce7a0f6630530acf34045391b74460fcd714de54" -dependencies = [ - "zerofrom-derive", -] - -[[package]] -name = "zerofrom-derive" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8785f47d6062c1932866147f91297286a9f350b3070e9d9f0b6078e37d623c1a" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", -] [[package]] name = "zerovec" -version = "0.9.0" +version = "0.9.2" dependencies = [ "bincode", "criterion", "databake", "getrandom", "iai", - "icu_benchmark_macros", "postcard", "rand", "rand_distr", @@ -1048,9 +871,9 @@ dependencies = [ [[package]] name = "zerovec-derive" -version = "0.9.0" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "490e5f878c2856225e884c35927e7ea6db3c24cdb7229b72542c7526ad7ed49e" +checksum = "c630983d26a5f0c061dad3bf22df69a7329b4939a9752bc5f19f1cbd8e2263db" dependencies = [ "proc-macro2", "quote", diff --git a/vendor/zerovec/Cargo.toml b/vendor/zerovec/Cargo.toml index 2e305d302..2490aa0dc 100644 --- a/vendor/zerovec/Cargo.toml +++ b/vendor/zerovec/Cargo.toml @@ -12,7 +12,7 @@ [package] edition = "2021" name = "zerovec" -version = "0.9.0" +version = "0.9.2" authors = ["The ICU4X Project Developers"] include = [ "src/**/*", @@ -41,9 +41,15 @@ license = "Unicode-DFS-2016" repository = "https://github.com/unicode-org/icu4x" resolver = "2" +[package.metadata.workspaces] +independent = true + [package.metadata.docs.rs] all-features = true +[package.metadata.cargo-all-features] +denylist = ["bench"] + [[example]] name = "zv_serde" required-features = ["serde"] @@ -71,7 +77,7 @@ harness = false required-features = ["serde"] [dependencies.databake] -version = "0.1.0" +version = "0.1.3" features = ["derive"] optional = true @@ -82,14 +88,14 @@ optional = true default-features = false [dependencies.yoke] -version = "0.6.0" +version = "0.7.0" optional = true [dependencies.zerofrom] -version = "0.1.0" +version = "0.1.1" [dependencies.zerovec-derive] -version = "0.9.0" +version = "0.9.2" optional = true [dev-dependencies.bincode] @@ -105,9 +111,6 @@ features = ["js"] [dev-dependencies.iai] version = "0.1" -[dev-dependencies.icu_benchmark_macros] -version = "0.7" - [dev-dependencies.postcard] version = "1.0.0" features = ["use-std"] @@ -128,15 +131,7 @@ features = ["derive"] [dev-dependencies.serde_json] version = "1.0" -[dev-dependencies.yoke] -version = "0.6.0" -features = ["derive"] - -[dev-dependencies.zerofrom] -version = "0.1.0" -features = ["derive"] - [features] bench = [] -derive = ["zerovec-derive"] +derive = ["dep:zerovec-derive"] std = [] diff --git a/vendor/zerovec/README.md b/vendor/zerovec/README.md index dbde4022c..b650d7dbd 100644 --- a/vendor/zerovec/README.md +++ b/vendor/zerovec/README.md @@ -32,7 +32,7 @@ works under the hood. ## Cargo features -This crate has five optional features: +This crate has several optional Cargo features: - `serde`: Allows serializing and deserializing `zerovec`'s abstractions via [`serde`](https://docs.rs/serde) - `yoke`: Enables implementations of `Yokeable` from the [`yoke`](https://docs.rs/yoke/) crate, which is also useful in situations involving a lot of zero-copy deserialization. diff --git a/vendor/zerovec/benches/vzv.rs b/vendor/zerovec/benches/vzv.rs index 3bee5add6..94b6621a9 100644 --- a/vendor/zerovec/benches/vzv.rs +++ b/vendor/zerovec/benches/vzv.rs @@ -102,7 +102,7 @@ fn binary_search_benches(c: &mut Criterion) { let (needles, _) = random_alphanums(2..=20, 10, seed); let bytes: Vec = VarZeroVec::::from(&string_vec).into_bytes(); let vzv = VarZeroVec::::parse_byte_slice(black_box(bytes.as_slice())).unwrap(); - let single_needle = "lmnop".to_string(); + let single_needle = "lmnop".to_owned(); // *** Binary search vec of 500 strings 10 times *** c.bench_function("vzv/binary_search/slice", |b| { @@ -169,7 +169,7 @@ fn vzv_precompute_bench(c: &mut Criterion) { let vzv = VarZeroVec::::parse_byte_slice(black_box(bytes.as_slice())).unwrap(); let borrowed = vzv.as_components(); let slice = vzv.as_slice(); - let single_needle = "lmnop".to_string(); + let single_needle = "lmnop"; c.bench_function("vzv_precompute/get/precomputed", |b| { b.iter(|| black_box(&borrowed).get(100)); @@ -180,11 +180,11 @@ fn vzv_precompute_bench(c: &mut Criterion) { }); c.bench_function("vzv_precompute/search/precomputed", |b| { - b.iter(|| black_box(&borrowed).binary_search(&single_needle)); + b.iter(|| black_box(&borrowed).binary_search(single_needle)); }); c.bench_function("vzv_precompute/search/slice", |b| { - b.iter(|| black_box(&slice).binary_search(&single_needle)); + b.iter(|| black_box(&slice).binary_search(single_needle)); }); c.bench_function("vzv_precompute/search_multi/precomputed", |b| { diff --git a/vendor/zerovec/benches/zeromap.rs b/vendor/zerovec/benches/zeromap.rs index 40225ba7a..069331979 100644 --- a/vendor/zerovec/benches/zeromap.rs +++ b/vendor/zerovec/benches/zeromap.rs @@ -56,7 +56,8 @@ const POSTCARD_HASHMAP: [u8; 176] = [ 114, 97, 98, 105, 99, ]; -/// Run this function to print new data to the console. Requires the optional `serde` feature. +/// Run this function to print new data to the console. +/// Requires the optional `serde` Cargo feature. #[allow(dead_code)] fn generate() { let map = build_zeromap(false); @@ -64,7 +65,8 @@ fn generate() { println!("{:?}", buf); } -/// Run this function to print new data to the console. Requires the optional `serde` feature. +/// Run this function to print new data to the console. +/// Requires the optional `serde` Cargo feature. #[allow(dead_code)] fn generate_hashmap() { let map = build_hashmap(false); @@ -180,13 +182,13 @@ fn bench_hashmap(c: &mut Criterion) { fn build_hashmap(large: bool) -> HashMap { let mut map: HashMap = HashMap::new(); - for (key, value) in DATA.iter() { + for &(key, value) in DATA.iter() { if large { for n in 0..8192 { - map.insert(format!("{}{}", key, n), value.to_string()); + map.insert(format!("{}{}", key, n), value.to_owned()); } } else { - map.insert(key.to_string(), value.to_string()); + map.insert(key.to_owned(), value.to_owned()); } } map @@ -197,7 +199,7 @@ fn bench_deserialize_hashmap(c: &mut Criterion) { b.iter(|| { let map: HashMap = postcard::from_bytes(black_box(&POSTCARD_HASHMAP)).unwrap(); - assert_eq!(map.get("iu"), Some(&"Inuktitut".to_string())); + assert_eq!(map.get("iu"), Some(&"Inuktitut".to_owned())); }) }); } @@ -207,7 +209,7 @@ fn bench_deserialize_large_hashmap(c: &mut Criterion) { c.bench_function("zeromap/deserialize/large/hashmap", |b| { b.iter(|| { let map: HashMap = postcard::from_bytes(black_box(&buf)).unwrap(); - assert_eq!(map.get("iu3333"), Some(&"Inuktitut".to_string())); + assert_eq!(map.get("iu3333"), Some(&"Inuktitut".to_owned())); }) }); } @@ -216,7 +218,7 @@ fn bench_lookup_hashmap(c: &mut Criterion) { let map: HashMap = postcard::from_bytes(black_box(&POSTCARD_HASHMAP)).unwrap(); c.bench_function("zeromap/lookup/small/hashmap", |b| { b.iter(|| { - assert_eq!(map.get(black_box("iu")), Some(&"Inuktitut".to_string())); + assert_eq!(map.get(black_box("iu")), Some(&"Inuktitut".to_owned())); assert_eq!(map.get(black_box("zz")), None); }); }); @@ -227,7 +229,7 @@ fn bench_lookup_large_hashmap(c: &mut Criterion) { let map: HashMap = postcard::from_bytes(&buf).unwrap(); c.bench_function("zeromap/lookup/large/hashmap", |b| { b.iter(|| { - assert_eq!(map.get(black_box("iu3333")), Some(&"Inuktitut".to_string())); + assert_eq!(map.get(black_box("iu3333")), Some(&"Inuktitut".to_owned())); assert_eq!(map.get(black_box("zz")), None); }); }); diff --git a/vendor/zerovec/src/flexzerovec/serde.rs b/vendor/zerovec/src/flexzerovec/serde.rs index 44179be32..fb7caa7a8 100644 --- a/vendor/zerovec/src/flexzerovec/serde.rs +++ b/vendor/zerovec/src/flexzerovec/serde.rs @@ -42,7 +42,7 @@ impl<'de> Visitor<'de> for FlexZeroVecVisitor { } } -/// This impl can be made available by enabling the optional `serde` feature of the `zerovec` crate +/// This impl requires enabling the optional `serde` Cargo feature of the `zerovec` crate impl<'de, 'a> Deserialize<'de> for FlexZeroVec<'a> where 'de: 'a, @@ -60,7 +60,7 @@ where } } -/// This impl can be made available by enabling the optional `serde` feature of the `zerovec` crate +/// This impl requires enabling the optional `serde` Cargo feature of the `zerovec` crate impl<'de, 'a> Deserialize<'de> for &'a FlexZeroSlice where 'de: 'a, @@ -87,7 +87,7 @@ where } } -/// This impl can be made available by enabling the optional `serde` feature of the `zerovec` crate +/// This impl requires enabling the optional `serde` Cargo feature of the `zerovec` crate impl Serialize for FlexZeroVec<'_> { fn serialize(&self, serializer: S) -> Result where @@ -105,7 +105,7 @@ impl Serialize for FlexZeroVec<'_> { } } -/// This impl can be made available by enabling the optional `serde` feature of the `zerovec` crate +/// This impl requires enabling the optional `serde` Cargo feature of the `zerovec` crate impl Serialize for FlexZeroSlice { fn serialize(&self, serializer: S) -> Result where diff --git a/vendor/zerovec/src/flexzerovec/slice.rs b/vendor/zerovec/src/flexzerovec/slice.rs index 7cc6f12fa..ee164d05b 100644 --- a/vendor/zerovec/src/flexzerovec/slice.rs +++ b/vendor/zerovec/src/flexzerovec/slice.rs @@ -14,7 +14,6 @@ const USIZE_WIDTH: usize = mem::size_of::(); /// A zero-copy "slice" that efficiently represents `[usize]`. #[repr(packed)] -#[derive(Eq, PartialEq)] pub struct FlexZeroSlice { // Hard Invariant: 1 <= width <= USIZE_WIDTH (which is target_pointer_width) // Soft Invariant: width == the width of the largest element @@ -23,6 +22,13 @@ pub struct FlexZeroSlice { data: [u8], } +impl PartialEq for FlexZeroSlice { + fn eq(&self, other: &Self) -> bool { + self.width == other.width && self.data == other.data + } +} +impl Eq for FlexZeroSlice {} + /// Helper function to decode a little-endian "chunk" (byte slice of a specific length) /// into a `usize`. We cannot call `usize::from_le_bytes` directly because that function /// requires the high bits to be set to 0. diff --git a/vendor/zerovec/src/lib.rs b/vendor/zerovec/src/lib.rs index 9a37c762e..b8b292488 100644 --- a/vendor/zerovec/src/lib.rs +++ b/vendor/zerovec/src/lib.rs @@ -34,7 +34,7 @@ //! //! # Cargo features //! -//! This crate has five optional features: +//! This crate has several optional Cargo features: //! - `serde`: Allows serializing and deserializing `zerovec`'s abstractions via [`serde`](https://docs.rs/serde) //! - `yoke`: Enables implementations of `Yokeable` from the [`yoke`](https://docs.rs/yoke/) crate, which is also useful //! in situations involving a lot of zero-copy deserialization. @@ -270,6 +270,8 @@ pub mod maps { pub use crate::map2d::ZeroMap2dBorrowed; pub use crate::map::{MutableZeroVecLike, ZeroMapKV, ZeroVecLike}; + + pub use crate::map2d::ZeroMap2dCursor; } pub mod vecs { @@ -395,8 +397,9 @@ pub use zerovec_derive::make_ule; /// Generate a corresponding [`VarULE`] type and the relevant [`EncodeAsVarULE`]/[`zerofrom::ZeroFrom`] /// implementations for this type /// -/// This can be attached to structs containing only [`AsULE`] types with the last field being [`Cow<'a, str>`](alloc::borrow::Cow), -/// [`Cow<'a, str>`](alloc::borrow::Cow), [`ZeroSlice`], or [`VarZeroSlice`]. +/// This can be attached to structs containing only [`AsULE`] types with the last fields being +/// [`Cow<'a, str>`](alloc::borrow::Cow), [`ZeroSlice`], or [`VarZeroSlice`]. If there is more than one such field, it will be represented +/// using [`MultiFieldsULE`](crate::ule::MultiFieldsULE) and getters will be generated. /// /// The type must be [`PartialEq`] and [`Eq`]. /// diff --git a/vendor/zerovec/src/map/borrowed.rs b/vendor/zerovec/src/map/borrowed.rs index 4c1d1aef6..9d0854601 100644 --- a/vendor/zerovec/src/map/borrowed.rs +++ b/vendor/zerovec/src/map/borrowed.rs @@ -163,11 +163,6 @@ where /// let borrowed = map.as_borrowed(); /// assert_eq!(borrowed.get(&1), Some("one")); /// assert_eq!(borrowed.get(&3), None); - /// - /// let borrow = borrowed.get(&1); - /// drop(borrowed); - /// // still exists after the ZeroMapBorrowed has been dropped - /// assert_eq!(borrow, Some("one")); /// ``` pub fn get(&self, key: &K) -> Option<&'a V::GetType> { let index = self.keys.zvl_binary_search(key).ok()?; @@ -190,11 +185,6 @@ where /// let borrowed = map.as_borrowed(); /// assert_eq!(borrowed.get_by(|probe| probe.cmp(&1)), Some("one")); /// assert_eq!(borrowed.get_by(|probe| probe.cmp(&3)), None); - /// - /// let borrow = borrowed.get_by(|probe| probe.cmp(&1)); - /// drop(borrowed); - /// // still exists after the ZeroMapBorrowed has been dropped - /// assert_eq!(borrow, Some("one")); /// ``` pub fn get_by(&self, predicate: impl FnMut(&K) -> Ordering) -> Option<&'a V::GetType> { let index = self.keys.zvl_binary_search_by(predicate).ok()?; @@ -211,8 +201,8 @@ where /// map.insert(&1, "one"); /// map.insert(&2, "two"); /// let borrowed = map.as_borrowed(); - /// assert_eq!(borrowed.contains_key(&1), true); - /// assert_eq!(borrowed.contains_key(&3), false); + /// assert!(borrowed.contains_key(&1)); + /// assert!(!borrowed.contains_key(&3)); /// ``` pub fn contains_key(&self, key: &K) -> bool { self.keys.zvl_binary_search(key).is_ok() diff --git a/vendor/zerovec/src/map/map.rs b/vendor/zerovec/src/map/map.rs index 379b22667..692e265d6 100644 --- a/vendor/zerovec/src/map/map.rs +++ b/vendor/zerovec/src/map/map.rs @@ -194,8 +194,8 @@ where /// let mut map = ZeroMap::new(); /// map.insert(&1, "one"); /// map.insert(&2, "two"); - /// assert_eq!(map.contains_key(&1), true); - /// assert_eq!(map.contains_key(&3), false); + /// assert!(map.contains_key(&1)); + /// assert!(!map.contains_key(&3)); /// ``` pub fn contains_key(&self, key: &K) -> bool { self.keys.zvl_binary_search(key).is_ok() diff --git a/vendor/zerovec/src/map/serde.rs b/vendor/zerovec/src/map/serde.rs index dbe4b433d..e82886d2a 100644 --- a/vendor/zerovec/src/map/serde.rs +++ b/vendor/zerovec/src/map/serde.rs @@ -9,7 +9,7 @@ use serde::de::{self, Deserialize, Deserializer, MapAccess, SeqAccess, Visitor}; #[cfg(feature = "serde")] use serde::ser::{Serialize, SerializeMap, SerializeSeq, Serializer}; -/// This impl can be made available by enabling the optional `serde` feature of the `zerovec` crate +/// This impl requires enabling the optional `serde` Cargo feature of the `zerovec` crate #[cfg(feature = "serde")] impl<'a, K, V> Serialize for ZeroMap<'a, K, V> where @@ -49,7 +49,7 @@ where } } -/// This impl can be made available by enabling the optional `serde` feature of the `zerovec` crate +/// This impl requires enabling the optional `serde` Cargo feature of the `zerovec` crate #[cfg(feature = "serde")] impl<'a, K, V> Serialize for ZeroMapBorrowed<'a, K, V> where @@ -158,7 +158,7 @@ where } } -/// This impl can be made available by enabling the optional `serde` feature of the `zerovec` crate +/// This impl requires enabling the optional `serde` Cargo feature of the `zerovec` crate impl<'de, 'a, K, V> Deserialize<'de> for ZeroMap<'a, K, V> where K: ZeroMapKV<'a> + Ord + ?Sized, @@ -190,7 +190,7 @@ where } } -// /// This impl can be made available by enabling the optional `serde` feature of the `zerovec` crate +// /// This impl requires enabling the optional `serde` Cargo feature of the `zerovec` crate impl<'de, 'a, K, V> Deserialize<'de> for ZeroMapBorrowed<'a, K, V> where K: ZeroMapKV<'a> + Ord + ?Sized, diff --git a/vendor/zerovec/src/map2d/borrowed.rs b/vendor/zerovec/src/map2d/borrowed.rs index d9972fae9..209da299b 100644 --- a/vendor/zerovec/src/map2d/borrowed.rs +++ b/vendor/zerovec/src/map2d/borrowed.rs @@ -199,11 +199,6 @@ where /// assert_eq!(borrowed.get_2d(&2, "one"), Some("bar")); /// assert_eq!(borrowed.get_2d(&2, "two"), Some("baz")); /// assert_eq!(borrowed.get_2d(&3, "three"), None); - /// - /// let borrow = borrowed.get_2d(&1, "one"); - /// drop(borrowed); - /// // still exists after the ZeroMap2dBorrowed has been dropped - /// assert_eq!(borrow, Some("foo")); /// ``` pub fn get_2d(&self, key0: &K0, key1: &K1) -> Option<&'a V::GetType> { self.get0(key0)?.get1(key1) @@ -270,8 +265,8 @@ where /// map.insert(&1, "one", "foo"); /// map.insert(&2, "two", "bar"); /// let borrowed = map.as_borrowed(); - /// assert_eq!(borrowed.contains_key0(&1), true); - /// assert_eq!(borrowed.contains_key0(&3), false); + /// assert!(borrowed.contains_key0(&1)); + /// assert!(!borrowed.contains_key0(&3)); /// ``` pub fn contains_key0(&self, key0: &K0) -> bool { self.keys0.zvl_binary_search(key0).is_ok() diff --git a/vendor/zerovec/src/map2d/cursor.rs b/vendor/zerovec/src/map2d/cursor.rs index 0654ee794..4802187be 100644 --- a/vendor/zerovec/src/map2d/cursor.rs +++ b/vendor/zerovec/src/map2d/cursor.rs @@ -92,7 +92,9 @@ where self.keys0.zvl_get(self.key0_index).unwrap() } - /// Borrow an ordered iterator over keys1 for a particular key0. + /// Borrow an ordered iterator over keys1 and values for a particular key0. + /// + /// To get the values as copy types, see [`Self::iter1_copied`]. /// /// For an example, see [`ZeroMap2d::iter0()`]. pub fn iter1( @@ -150,6 +152,64 @@ where } } +impl<'l, 'a, K0, K1, V> ZeroMap2dCursor<'l, 'a, K0, K1, V> +where + K0: ZeroMapKV<'a>, + K1: ZeroMapKV<'a>, + V: ZeroMapKV<'a>, + K0: ?Sized, + K1: ?Sized, + V: Copy, +{ + /// Borrow an ordered iterator over keys1 and values for a particular key0. + /// + /// The values are returned as copy types. + /// + /// # Examples + /// + /// ``` + /// use zerovec::ZeroMap2d; + /// + /// let zm2d: ZeroMap2d = [ + /// ("a", 0u8, 1usize), + /// ("b", 1u8, 1000usize), + /// ("b", 2u8, 2000usize), + /// ] + /// .into_iter() + /// .collect(); + /// + /// let mut total_value = 0; + /// + /// for cursor in zm2d.iter0() { + /// for (_, value) in cursor.iter1_copied() { + /// total_value += value; + /// } + /// } + /// + /// assert_eq!(total_value, 3001); + /// ``` + pub fn iter1_copied( + &self, + ) -> impl Iterator>::GetType, V)> + '_ { + let range = self.get_range(); + #[allow(clippy::unwrap_used)] // `self.get_range()` returns a valid range + range.map(move |idx| { + ( + self.keys1.zvl_get(idx).unwrap(), + self.get1_copied_at(idx).unwrap(), + ) + }) + } + + fn get1_copied_at(&self, index: usize) -> Option { + let ule = self.values.zvl_get(index)?; + let mut result = Option::::None; + V::Container::zvl_get_as_t(ule, |v| result.replace(*v)); + #[allow(clippy::unwrap_used)] // `zvl_get_as_t` guarantees that the callback is invoked + Some(result.unwrap()) + } +} + impl<'l, 'a, K0, K1, V> ZeroMap2dCursor<'l, 'a, K0, K1, V> where K0: ZeroMapKV<'a>, @@ -253,14 +313,6 @@ where let key1_index = self.get_key1_index_by(predicate)?; self.get1_copied_at(key1_index) } - - fn get1_copied_at(&self, index: usize) -> Option { - let ule = self.values.zvl_get(index)?; - let mut result = Option::::None; - V::Container::zvl_get_as_t(ule, |v| result.replace(*v)); - #[allow(clippy::unwrap_used)] // `zvl_get_as_t` guarantees that the callback is invoked - Some(result.unwrap()) - } } // We can't use the default PartialEq because ZeroMap2d is invariant diff --git a/vendor/zerovec/src/map2d/map.rs b/vendor/zerovec/src/map2d/map.rs index ab6eded4e..e6545dfa5 100644 --- a/vendor/zerovec/src/map2d/map.rs +++ b/vendor/zerovec/src/map2d/map.rs @@ -534,8 +534,8 @@ where /// let mut map = ZeroMap2d::new(); /// map.insert(&1, "one", "foo"); /// map.insert(&2, "two", "bar"); - /// assert_eq!(map.contains_key0(&1), true); - /// assert_eq!(map.contains_key0(&3), false); + /// assert!(map.contains_key0(&1)); + /// assert!(!map.contains_key0(&3)); /// ``` pub fn contains_key0(&self, key0: &K0) -> bool { self.keys0.zvl_binary_search(key0).is_ok() @@ -814,13 +814,13 @@ mod test { // Remove some elements let result = zm2d.remove(&3, "ccc"); // first element - assert_eq!(result, Some(String::from("CCC").into_boxed_str())); + assert_eq!(result.as_deref(), Some("CCC")); let result = zm2d.remove(&3, "mmm"); // middle element - assert_eq!(result, Some(String::from("MM0").into_boxed_str())); + assert_eq!(result.as_deref(), Some("MM0")); let result = zm2d.remove(&5, "ddd"); // singleton K0 - assert_eq!(result, Some(String::from("DD1").into_boxed_str())); + assert_eq!(result.as_deref(), Some("DD1")); let result = zm2d.remove(&9, "yyy"); // last element - assert_eq!(result, Some(String::from("YYY").into_boxed_str())); + assert_eq!(result.as_deref(), Some("YYY")); assert_eq!(format!("{:?}", zm2d), "ZeroMap2d { keys0: ZeroVec([3, 6, 7]), joiner: ZeroVec([1, 4, 7]), keys1: [\"eee\", \"ddd\", \"mmm\", \"nnn\", \"ddd\", \"eee\", \"www\"], values: [\"EEE\", \"DD3\", \"MM1\", \"NNN\", \"DD2\", \"EEE\", \"WWW\"] }"); } diff --git a/vendor/zerovec/src/map2d/serde.rs b/vendor/zerovec/src/map2d/serde.rs index f8b5f147b..b5e913654 100644 --- a/vendor/zerovec/src/map2d/serde.rs +++ b/vendor/zerovec/src/map2d/serde.rs @@ -12,7 +12,7 @@ use serde::de::{self, Deserialize, Deserializer, MapAccess, Visitor}; #[cfg(feature = "serde")] use serde::ser::{Serialize, SerializeMap, Serializer}; -/// This impl can be made available by enabling the optional `serde` feature of the `zerovec` crate +/// This impl requires enabling the optional `serde` Cargo feature of the `zerovec` crate #[cfg(feature = "serde")] impl<'a, K0, K1, V> Serialize for ZeroMap2d<'a, K0, K1, V> where @@ -75,7 +75,7 @@ where } } -/// This impl can be made available by enabling the optional `serde` feature of the `zerovec` crate +/// This impl requires enabling the optional `serde` Cargo feature of the `zerovec` crate #[cfg(feature = "serde")] impl<'a, K0, K1, V> Serialize for ZeroMap2dBorrowed<'a, K0, K1, V> where @@ -220,7 +220,7 @@ where } } -/// This impl can be made available by enabling the optional `serde` feature of the `zerovec` crate +/// This impl requires enabling the optional `serde` Cargo feature of the `zerovec` crate impl<'de, 'a, K0, K1, V> Deserialize<'de> for ZeroMap2d<'a, K0, K1, V> where K0: ZeroMapKV<'a> + Ord + ?Sized, @@ -287,7 +287,7 @@ where } } -/// This impl can be made available by enabling the optional `serde` feature of the `zerovec` crate +/// This impl requires enabling the optional `serde` Cargo feature of the `zerovec` crate impl<'de, 'a, K0, K1, V> Deserialize<'de> for ZeroMap2dBorrowed<'a, K0, K1, V> where K0: ZeroMapKV<'a> + Ord + ?Sized, diff --git a/vendor/zerovec/src/ule/mod.rs b/vendor/zerovec/src/ule/mod.rs index 29c7d0ecd..e8ecd26e5 100644 --- a/vendor/zerovec/src/ule/mod.rs +++ b/vendor/zerovec/src/ule/mod.rs @@ -283,6 +283,12 @@ where /// "12.3e3" are logically equal, but not byte-for-byte equal, so we could define a canonical form /// where only a single digit is allowed before `.`. /// +/// There may also be cases where a `VarULE` has muiltiple canonical forms, such as a faster +/// version and a smaller version. The cleanest way to handle this case would be separate types. +/// However, if this is not feasible, then the application should ensure that the data it is +/// deserializing is in the expected form. For example, if the data is being loaded from an +/// external source, then requests could carry information about the expected form of the data. +/// /// Failure to follow this invariant will cause surprising behavior in `PartialEq`, which may /// result in unpredictable operations on `ZeroVec`, `VarZeroVec`, and `ZeroMap`. pub unsafe trait VarULE: 'static { diff --git a/vendor/zerovec/src/ule/option.rs b/vendor/zerovec/src/ule/option.rs index e1d2d25fa..a6b1966a5 100644 --- a/vendor/zerovec/src/ule/option.rs +++ b/vendor/zerovec/src/ule/option.rs @@ -22,7 +22,7 @@ use core::mem::{self, MaybeUninit}; /// Some('ł'), /// ]); /// -/// assert_eq!(z.get(2), Some(Some(('ø')))); +/// assert_eq!(z.get(2), Some(Some('ø'))); /// assert_eq!(z.get(3), Some(None)); /// ``` // Invariants: diff --git a/vendor/zerovec/src/ule/plain.rs b/vendor/zerovec/src/ule/plain.rs index 0b1bbb441..49455d45f 100644 --- a/vendor/zerovec/src/ule/plain.rs +++ b/vendor/zerovec/src/ule/plain.rs @@ -7,10 +7,7 @@ use super::*; use crate::ZeroSlice; -use core::{ - mem, - num::{NonZeroI8, NonZeroU8}, -}; +use core::num::{NonZeroI8, NonZeroU8}; /// A u8 array of little-endian data with infallible conversions to and from &[u8]. #[repr(transparent)] @@ -100,19 +97,7 @@ macro_rules! impl_const_constructors { let len = bytes.len(); #[allow(clippy::modulo_one)] if len % $size == 0 { - unsafe { - // Most of the slice manipulation functions are not yet const-stable, - // so we construct a slice with the right metadata and cast its type - // https://rust-lang.github.io/unsafe-code-guidelines/layout/pointers.html#notes - // - // Safety: - // * [u8] and [RawBytesULE] have different lengths but the same alignment - // * ZeroSlice<$base> is repr(transparent) with [RawBytesULE] - let [ptr, _]: [usize; 2] = mem::transmute(bytes); - let new_len = len / $size; - let raw = [ptr, new_len]; - Ok(mem::transmute(raw)) - } + Ok(unsafe { Self::from_bytes_unchecked(bytes) }) } else { Err(ZeroVecError::InvalidLength { ty: concat!(""), diff --git a/vendor/zerovec/src/ule/unvalidated.rs b/vendor/zerovec/src/ule/unvalidated.rs index a6ae55dcf..4564c8673 100644 --- a/vendor/zerovec/src/ule/unvalidated.rs +++ b/vendor/zerovec/src/ule/unvalidated.rs @@ -95,9 +95,9 @@ impl UnvalidatedStr { /// ``` /// use zerovec::ule::UnvalidatedStr; /// - /// static a: &UnvalidatedStr = UnvalidatedStr::from_bytes(b"abc"); + /// static A: &UnvalidatedStr = UnvalidatedStr::from_bytes(b"abc"); /// - /// let b = a.try_as_str().unwrap(); + /// let b = A.try_as_str().unwrap(); /// assert_eq!(b, "abc"); /// ``` // Note: this is const starting in 1.63 @@ -154,7 +154,7 @@ unsafe impl VarULE for UnvalidatedStr { } } -/// This impl can be made available by enabling the optional `serde` feature of the `zerovec` crate +/// This impl requires enabling the optional `serde` Cargo feature of the `zerovec` crate #[cfg(feature = "serde")] impl serde::Serialize for UnvalidatedStr { fn serialize(&self, serializer: S) -> Result @@ -173,7 +173,7 @@ impl serde::Serialize for UnvalidatedStr { } } -/// This impl can be made available by enabling the optional `serde` feature of the `zerovec` crate +/// This impl requires enabling the optional `serde` Cargo feature of the `zerovec` crate #[cfg(feature = "serde")] impl<'de> serde::Deserialize<'de> for Box { fn deserialize(deserializer: D) -> Result @@ -190,7 +190,7 @@ impl<'de> serde::Deserialize<'de> for Box { } } -/// This impl can be made available by enabling the optional `serde` feature of the `zerovec` crate +/// This impl requires enabling the optional `serde` Cargo feature of the `zerovec` crate #[cfg(feature = "serde")] impl<'de, 'a> serde::Deserialize<'de> for &'a UnvalidatedStr where diff --git a/vendor/zerovec/src/varzerovec/serde.rs b/vendor/zerovec/src/varzerovec/serde.rs index dd6e863ff..649b29cfb 100644 --- a/vendor/zerovec/src/varzerovec/serde.rs +++ b/vendor/zerovec/src/varzerovec/serde.rs @@ -60,7 +60,7 @@ where } } -/// This impl can be made available by enabling the optional `serde` feature of the `zerovec` crate +/// This impl requires enabling the optional `serde` Cargo feature of the `zerovec` crate impl<'de, 'a, T, F> Deserialize<'de> for VarZeroVec<'a, T, F> where T: VarULE + ?Sized, @@ -81,7 +81,7 @@ where } } -/// This impl can be made available by enabling the optional `serde` feature of the `zerovec` crate +/// This impl requires enabling the optional `serde` Cargo feature of the `zerovec` crate impl<'de, 'a, T, F> Deserialize<'de> for &'a VarZeroSlice where T: VarULE + ?Sized, @@ -111,7 +111,7 @@ where } } -/// This impl can be made available by enabling the optional `serde` feature of the `zerovec` crate +/// This impl requires enabling the optional `serde` Cargo feature of the `zerovec` crate #[cfg(feature = "serde")] impl Serialize for VarZeroVec<'_, T, F> where @@ -134,7 +134,7 @@ where } } -/// This impl can be made available by enabling the optional `serde` feature of the `zerovec` crate +/// This impl requires enabling the optional `serde` Cargo feature of the `zerovec` crate #[cfg(feature = "serde")] impl Serialize for VarZeroSlice where diff --git a/vendor/zerovec/src/varzerovec/slice.rs b/vendor/zerovec/src/varzerovec/slice.rs index 59e8da03f..afdbe80d9 100644 --- a/vendor/zerovec/src/varzerovec/slice.rs +++ b/vendor/zerovec/src/varzerovec/slice.rs @@ -29,8 +29,13 @@ use core::ops::Range; /// The `F` type parameter is a [`VarZeroVecFormat`] (see its docs for more details), which can be used to select the /// precise format of the backing buffer with various size and performance tradeoffs. It defaults to [`Index16`]. /// -/// This type can be nested within itself to allow for multi-level nested `Vec`s, for -/// example the following code constructs the conceptual zero-copy equivalent of `Vec>>` +/// This type can be nested within itself to allow for multi-level nested `Vec`s. +/// +/// # Examples +/// +/// ## Nested Slices +/// +/// The following code constructs the conceptual zero-copy equivalent of `Vec>>` /// /// ```rust /// use zerovec::ule::*; @@ -71,6 +76,25 @@ use core::ops::Range; /// VarZeroVec::parse_byte_slice(bytes).unwrap(); /// assert_eq!(vzv_from_bytes, vzv_all); /// ``` +/// +/// ## Iterate over Windows +/// +/// Although [`VarZeroSlice`] does not itself have a `.windows` iterator like +/// [core::slice::Windows], this behavior can be easily modeled using an iterator: +/// +/// ``` +/// use zerovec::VarZeroVec; +/// +/// let vzv = VarZeroVec::::from(&["a", "b", "c", "d"]); +/// # let mut pairs: Vec<(&str, &str)> = Vec::new(); +/// +/// let mut it = vzv.iter().peekable(); +/// while let (Some(x), Some(y)) = (it.next(), it.peek()) { +/// // Evaluate (x, y) here. +/// # pairs.push((x, y)); +/// } +/// # assert_eq!(pairs, &[("a", "b"), ("b", "c"), ("c", "d")]); +/// ``` // // safety invariant: The slice MUST be one which parses to // a valid VarZeroVecComponents diff --git a/vendor/zerovec/src/varzerovec/vec.rs b/vendor/zerovec/src/varzerovec/vec.rs index 031da6453..7edb48a96 100644 --- a/vendor/zerovec/src/varzerovec/vec.rs +++ b/vendor/zerovec/src/varzerovec/vec.rs @@ -11,7 +11,7 @@ use core::ops::Deref; use super::*; -/// A zero-copy vector for variable-width types. +/// A zero-copy, byte-aligned vector for variable-width types. /// /// `VarZeroVec` is designed as a drop-in replacement for `Vec` in situations where it is /// desirable to borrow data from an unaligned byte slice, such as zero-copy deserialization, and @@ -39,6 +39,20 @@ use super::*; /// The `F` type parameter is a [`VarZeroVecFormat`] (see its docs for more details), which can be used to select the /// precise format of the backing buffer with various size and performance tradeoffs. It defaults to [`Index16`]. /// +/// # Bytes and Equality +/// +/// Two [`VarZeroVec`]s are equal if and only if their bytes are equal, as described in the trait +/// [`VarULE`]. However, we do not guarantee stability of byte equality or serialization format +/// across major SemVer releases. +/// +/// To compare a [`Vec`] to a [`VarZeroVec`], it is generally recommended to use +/// [`Iterator::eq`], since it is somewhat expensive at runtime to convert from a [`Vec`] to a +/// [`VarZeroVec`] or vice-versa. +/// +/// Prior to zerovec reaching 1.0, the precise byte representation of [`VarZeroVec`] is still +/// under consideration, with different options along the space-time spectrum. See +/// [#1410](https://github.com/unicode-org/icu4x/issues/1410). +/// /// # Example /// /// ```rust diff --git a/vendor/zerovec/src/yoke_impls.rs b/vendor/zerovec/src/yoke_impls.rs index 81fc22c74..0efb47a2d 100644 --- a/vendor/zerovec/src/yoke_impls.rs +++ b/vendor/zerovec/src/yoke_impls.rs @@ -15,7 +15,7 @@ use core::{mem, ptr}; use yoke::*; // This impl is similar to the impl on Cow and is safe for the same reasons -/// This impl can be made available by enabling the optional `yoke` feature of the `zerovec` crate +/// This impl requires enabling the optional `yoke` Cargo feature of the `zerovec` crate unsafe impl<'a, T: 'static + AsULE + ?Sized> Yokeable<'a> for ZeroVec<'static, T> { type Output = ZeroVec<'a, T>; #[inline] @@ -43,7 +43,7 @@ unsafe impl<'a, T: 'static + AsULE + ?Sized> Yokeable<'a> for ZeroVec<'static, T } // This impl is similar to the impl on Cow and is safe for the same reasons -/// This impl can be made available by enabling the optional `yoke` feature of the `zerovec` crate +/// This impl requires enabling the optional `yoke` Cargo feature of the `zerovec` crate unsafe impl<'a, T: 'static + VarULE + ?Sized> Yokeable<'a> for VarZeroVec<'static, T> { type Output = VarZeroVec<'a, T>; #[inline] @@ -71,7 +71,7 @@ unsafe impl<'a, T: 'static + VarULE + ?Sized> Yokeable<'a> for VarZeroVec<'stati } // This impl is similar to the impl on Cow and is safe for the same reasons -/// This impl can be made available by enabling the optional `yoke` feature of the `zerovec` crate +/// This impl requires enabling the optional `yoke` Cargo feature of the `zerovec` crate unsafe impl<'a> Yokeable<'a> for FlexZeroVec<'static> { type Output = FlexZeroVec<'a>; #[inline] @@ -98,7 +98,7 @@ unsafe impl<'a> Yokeable<'a> for FlexZeroVec<'static> { } } -/// This impl can be made available by enabling the optional `yoke` feature of the `zerovec` crate +/// This impl requires enabling the optional `yoke` Cargo feature of the `zerovec` crate #[allow(clippy::transmute_ptr_to_ptr)] unsafe impl<'a, K, V> Yokeable<'a> for ZeroMap<'static, K, V> where @@ -144,7 +144,7 @@ where } } -/// This impl can be made available by enabling the optional `yoke` feature of the `zerovec` crate +/// This impl requires enabling the optional `yoke` Cargo feature of the `zerovec` crate #[allow(clippy::transmute_ptr_to_ptr)] unsafe impl<'a, K, V> Yokeable<'a> for ZeroMapBorrowed<'static, K, V> where @@ -190,7 +190,7 @@ where } } -/// This impl can be made available by enabling the optional `yoke` feature of the `zerovec` crate +/// This impl requires enabling the optional `yoke` Cargo feature of the `zerovec` crate #[allow(clippy::transmute_ptr_to_ptr)] unsafe impl<'a, K0, K1, V> Yokeable<'a> for ZeroMap2d<'static, K0, K1, V> where @@ -238,7 +238,7 @@ where } } -/// This impl can be made available by enabling the optional `yoke` feature of the `zerovec` crate +/// This impl requires enabling the optional `yoke` Cargo feature of the `zerovec` crate #[allow(clippy::transmute_ptr_to_ptr)] unsafe impl<'a, K0, K1, V> Yokeable<'a> for ZeroMap2dBorrowed<'static, K0, K1, V> where diff --git a/vendor/zerovec/src/zerovec/mod.rs b/vendor/zerovec/src/zerovec/mod.rs index e0876338f..371450e21 100644 --- a/vendor/zerovec/src/zerovec/mod.rs +++ b/vendor/zerovec/src/zerovec/mod.rs @@ -22,7 +22,7 @@ use core::marker::PhantomData; use core::mem; use core::ops::Deref; -/// A zero-copy vector for fixed-width types. +/// A zero-copy, byte-aligned vector for fixed-width types. /// /// `ZeroVec` is designed as a drop-in replacement for `Vec` in situations where it is /// desirable to borrow data from an unaligned byte slice, such as zero-copy deserialization. @@ -352,11 +352,6 @@ where /// `bytes` need to be an output from [`ZeroSlice::as_bytes()`]. pub const unsafe fn from_bytes_unchecked(bytes: &'a [u8]) -> Self { // &[u8] and &[T::ULE] are the same slice with different length metadata. - /// core::slice::from_raw_parts(a, b) = core::mem::transmute((a, b)) hack - /// ```compile_fail - /// const unsafe fn canary() { core::slice::from_raw_parts(0 as *const u8, 0); } - /// ``` - const _: () = (); Self::new_borrowed(core::mem::transmute(( bytes.as_ptr(), bytes.len() / core::mem::size_of::(), diff --git a/vendor/zerovec/src/zerovec/serde.rs b/vendor/zerovec/src/zerovec/serde.rs index 8250fc20a..e3141071c 100644 --- a/vendor/zerovec/src/zerovec/serde.rs +++ b/vendor/zerovec/src/zerovec/serde.rs @@ -58,7 +58,7 @@ where } } -/// This impl can be made available by enabling the optional `serde` feature of the `zerovec` crate +/// This impl requires enabling the optional `serde` Cargo feature of the `zerovec` crate impl<'de, 'a, T> Deserialize<'de> for ZeroVec<'a, T> where T: 'de + Deserialize<'de> + AsULE, @@ -77,7 +77,7 @@ where } } -/// This impl can be made available by enabling the optional `serde` feature of the `zerovec` crate +/// This impl requires enabling the optional `serde` Cargo feature of the `zerovec` crate impl Serialize for ZeroVec<'_, T> where T: Serialize + AsULE, @@ -98,7 +98,7 @@ where } } -/// This impl can be made available by enabling the optional `serde` feature of the `zerovec` crate +/// This impl requires enabling the optional `serde` Cargo feature of the `zerovec` crate impl<'de, T> Deserialize<'de> for Box> where T: Deserialize<'de> + AsULE + 'static, @@ -113,7 +113,7 @@ where } } -/// This impl can be made available by enabling the optional `serde` feature of the `zerovec` crate +/// This impl requires enabling the optional `serde` Cargo feature of the `zerovec` crate impl<'de, 'a, T> Deserialize<'de> for &'a ZeroSlice where T: Deserialize<'de> + AsULE + 'static, @@ -141,7 +141,7 @@ where } } -/// This impl can be made available by enabling the optional `serde` feature of the `zerovec` crate +/// This impl requires enabling the optional `serde` Cargo feature of the `zerovec` crate impl Serialize for ZeroSlice where T: Serialize + AsULE, diff --git a/vendor/zerovec/src/zerovec/slice.rs b/vendor/zerovec/src/zerovec/slice.rs index ce27a15b2..847705304 100644 --- a/vendor/zerovec/src/zerovec/slice.rs +++ b/vendor/zerovec/src/zerovec/slice.rs @@ -65,12 +65,10 @@ where /// `bytes` need to be an output from [`ZeroSlice::as_bytes()`]. pub const unsafe fn from_bytes_unchecked(bytes: &[u8]) -> &Self { // &[u8] and &[T::ULE] are the same slice with different length metadata. - /// core::slice::from_raw_parts(a, b) = core::mem::transmute((a, b)) hack - /// ```compile_fail - /// const unsafe fn canary() { core::slice::from_raw_parts(0 as *const u8, 0); } - /// ``` - const _: () = (); - core::mem::transmute((bytes.as_ptr(), bytes.len() / core::mem::size_of::())) + Self::from_ule_slice(core::mem::transmute(( + bytes.as_ptr(), + bytes.len() / core::mem::size_of::(), + ))) } /// Construct a `&ZeroSlice` from a slice of ULEs. @@ -235,17 +233,17 @@ where /// ``` /// use zerovec::ZeroSlice; /// - /// const bytes: &[u8] = &[0xD3, 0x00, 0x19, 0x01, 0xA5, 0x01, 0xCD, 0x80]; - /// const zs_u16: &ZeroSlice = { - /// match ZeroSlice::::try_from_bytes(bytes) { + /// const BYTES: &[u8] = &[0xD3, 0x00, 0x19, 0x01, 0xA5, 0x01, 0xCD, 0x80]; + /// const ZS_U16: &ZeroSlice = { + /// match ZeroSlice::::try_from_bytes(BYTES) { /// Ok(s) => s, /// Err(_) => unreachable!(), /// } /// }; /// - /// let zs_i16: &ZeroSlice = zs_u16.cast(); + /// let zs_i16: &ZeroSlice = ZS_U16.cast(); /// - /// assert_eq!(zs_u16.get(3), Some(32973)); + /// assert_eq!(ZS_U16.get(3), Some(32973)); /// assert_eq!(zs_i16.get(3), Some(-32563)); /// ``` #[inline] @@ -268,18 +266,18 @@ where /// ``` /// use zerovec::ZeroSlice; /// - /// const bytes: &[u8] = &[0x7F, 0xF3, 0x01, 0x00, 0x49, 0xF6, 0x01, 0x00]; - /// const zs_u32: &ZeroSlice = { - /// match ZeroSlice::::try_from_bytes(bytes) { + /// const BYTES: &[u8] = &[0x7F, 0xF3, 0x01, 0x00, 0x49, 0xF6, 0x01, 0x00]; + /// const ZS_U32: &ZeroSlice = { + /// match ZeroSlice::::try_from_bytes(BYTES) { /// Ok(s) => s, /// Err(_) => unreachable!(), /// } /// }; /// /// let zs_u8_4: &ZeroSlice<[u8; 4]> = - /// zs_u32.try_as_converted().expect("valid code points"); + /// ZS_U32.try_as_converted().expect("valid code points"); /// - /// assert_eq!(zs_u32.get(0), Some(127871)); + /// assert_eq!(ZS_U32.get(0), Some(127871)); /// assert_eq!(zs_u8_4.get(0), Some([0x7F, 0xF3, 0x01, 0x00])); /// ``` #[inline] -- cgit v1.2.3