Vendor dependencies for 0.3.0 release

This commit is contained in:
2025-09-27 10:29:08 -05:00
parent 0c8d39d483
commit 82ab7f317b
26803 changed files with 16134934 additions and 0 deletions

1
vendor/tinyvec/.cargo-checksum.json vendored Normal file
View File

@@ -0,0 +1 @@
{"files":{"CHANGELOG.md":"83dc6252c1c505654e14131a7d1ead86d683771fc0e2e56280442f686577d34a","Cargo.lock":"48aca264f1fb5979f5b9598d001c83d07353e05e1d8725dcf73096375067ffff","Cargo.toml":"d002a4b0439290a4355c746038400c26ecb55ee4d68e530dad892b02419c7ff7","LICENSE-APACHE.md":"cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30","LICENSE-MIT.md":"fd80a26fbb3f644af1fa994134446702932968519797227e07a1368dea80f0bc","LICENSE-ZLIB.md":"84b34dd7608f7fb9b17bd588a6bf392bf7de504e2716f024a77d89f1b145a151","README.md":"3e1fb710657302adceca0f3a5ca37670503fa376fdc60f1abfd441a023d1489b","benches/macros.rs":"5a5a6f260dec23ccd52de69b6ec5996db66c5deb67a47398cdf1f06a777580b3","benches/smallvec.rs":"ab4bb1d32a1fa8f4ad41010e56485fa7e16d01d310a33d78990bd8416699a472","debug_metadata/README.md":"28d60ba44609690415f49d3dfddb199f04f2e7404bfbfcc1655b723447428c52","debug_metadata/tinyvec.natvis":"8161c399a4aeec63a1077b4f99ced085e8815c4dda548e93441f17ebedb8be11","rustfmt.toml":"55bb35d3cc5ad8a032329962ec718ea32c7812b343238529ba2690dc65ba1d4f","src/array.rs":"b5133f1c9b1e740468267ad106a9d1721c72cfe586dc6419e6a271e873e71dfe","src/array/const_generic_impl.rs":"2d83e6c59870d01c0f6b64d7065ab0d6fbb54f5f60de11f693ff4de4833d3fd5","src/array/generic_array_impl.rs":"13dfd7ab17f2d203c9e8a4859053134239b6de7040fa5253cf19d9958cc176d7","src/arrayvec.rs":"2fa35dfa66e6cb00ec7de4379f1312b3a9994b260500c65700b1abb6146bb96a","src/arrayvec_drain.rs":"dce67509b43f0e35cf0e20920983b04b17d0eb20272ed07c37b0d1b764d35094","src/lib.rs":"249c2872da9f7930c532b7d910eae1861852f83f10edf69286978ec950cd2f68","src/slicevec.rs":"5c192a6753b6571a791e25da50d64d79cd87a2a2e50bdefdb123f8a3a6dc0d88","src/tinyvec.rs":"a14edff2579e8661de218b9b5c1edbacacbbd2711ced431a50f297b8d97b9d0d","tests/arrayvec.rs":"1c2ee72747f74880bd04f896569a0e760680d40d9cb3afbb570244be7821a45b","tests/debugger_visualizer.rs":"d4de73d4875a6febaa317f103886eab0a95780124f746b218885559a0269beb0","tests/tinyvec.rs":"bd652ee26e5d61b9a9da518e7bf8d0ce2f68d81fe896fc8bf0d714cb2a5d099d"},"package":"bfa5fdc3bce6191a1dbc8c02d5c8bffcf557bafa17c124c5264a458f1b0613fa"}

110
vendor/tinyvec/CHANGELOG.md vendored Normal file
View File

@@ -0,0 +1,110 @@
# Changelog
## 1.10
* Minimum rust version is now 1.55, and the non-const-generic impls are removed.
This reduces build times by over a second on average, which is
significant enough for a library crate.
## 1.9
* Adds a `latest_stable_rust` cargo feature, which will automatically pull in
other cargo features related to the latest Stable version of rust.
* Adds `ArrayVec::try_from_array_len`
* Adds `TinyVec::into_vec` and `TinyVec::into_boxed_slice`
* Adds support for `generic-array` crate
* Adds support for the `borsh` crate
## 1.8.1
* [e00E](https://github.com/e00E) updated the rustc features so that they all
correctly depend on the lower version feature.
[pr 199](https://github.com/Lokathor/tinyvec/pull/199)
## 1.8
* [Fuuzetsu](https://github.com/Fuuzetsu) added the `ArrayVec::as_inner` method.
[pr 197](https://github.com/Lokathor/tinyvec/pull/197)
## 1.7
* [Fuuzetsu](https://github.com/Fuuzetsu) added the `rustc_1_61` cargo feature, which adds the `retain_mut` method.
[pr 198](https://github.com/Lokathor/tinyvec/pull/198)
## 1.6.1
* [e00E](https://github.com/e00E) fixed the Arbitrary impl to work on Stable
without using a feature gate.
[pr 180](https://github.com/Lokathor/tinyvec/pull/180)
## 1.6.0
* [i509VCB](https://github.com/i509VCB) added the `try_` functions for fallable reallocation.
[pr 158](https://github.com/Lokathor/tinyvec/pull/158)
* [ajtribick](https://github.com/ajtribick) added more error impls to `TryFromSliceError`.
[pr 160](https://github.com/Lokathor/tinyvec/pull/160)
* The `std` feature now automatically enables the `alloc` feature as well.
## 1.5.1
* [madsmtm](https://github.com/madsmtm) fixed an error with the `alloc` feature on very old rustc versions.
[pr 154](https://github.com/Lokathor/tinyvec/pull/154)
## 1.5.0
* [eeeebbbbrrrr](https://github.com/eeeebbbbrrrr) added an impl for [std::io::Write](https://doc.rust-lang.org/std/io/trait.Write.html) to `TinyVec` when the element type is `u8`.
This is gated behind the new `std` feature.
[pr 152](https://github.com/Lokathor/tinyvec/pull/152)
## 1.4.0
* [saethlin](https://github.com/saethlin) stabilized the usage of const generics and array map with the `rustc_1_55` feature.
[pr 149](https://github.com/Lokathor/tinyvec/pull/149)
## 1.3.1
* Improved the performance of the `clone_from` method [pr 144](https://github.com/Lokathor/tinyvec/pull/144)
## 1.3.0
* [jeffa5](https://github.com/jeffa5) added arbitrary implementations for `TinyVec` and `ArrayVec` [pr 146](https://github.com/Lokathor/tinyvec/pull/146).
* [elomatreb](https://github.com/elomatreb) implemented `DoubleEndedIterator` for `TinyVecIterator` [pr 145](https://github.com/Lokathor/tinyvec/pull/145).
## 1.2.0
* [Cryptjar](https://github.com/Cryptjar) removed the `A:Array` bound on the struct of `ArrayVec<A:Array>`,
and added the `from_array_empty` method, which is a `const fn` constructor
[pr 141](https://github.com/Lokathor/tinyvec/pull/141).
## 1.1.1
* [saethlin](https://github.com/saethlin) contributed many PRs (
[127](https://github.com/Lokathor/tinyvec/pull/127),
[128](https://github.com/Lokathor/tinyvec/pull/128),
[129](https://github.com/Lokathor/tinyvec/pull/129),
[131](https://github.com/Lokathor/tinyvec/pull/131),
[132](https://github.com/Lokathor/tinyvec/pull/132)
) to help in several benchmarks.
## 1.1.0
* [slightlyoutofphase](https://github.com/slightlyoutofphase)
added "array splat" style syntax to the `array_vec!` and `tiny_vec!` macros.
You can now write `array_vec![true; 5]` and get a length 5 array vec full of `true`,
just like normal array initialization allows. Same goes for `tiny_vec!`.
([pr 118](https://github.com/Lokathor/tinyvec/pull/118))
* [not-a-seagull](https://github.com/not-a-seagull)
added `ArrayVec::into_inner` so that you can get the array out of an `ArrayVec`.
([pr 124](https://github.com/Lokathor/tinyvec/pull/124))
## 1.0.2
* Added license files for the MIT and Apache-2.0 license options.
## 1.0.1
* Display additional features in the [docs.rs/tinyvec](https://docs.rs/tinyvec) documentation.
## 1.0.0
Initial Stable Release.

732
vendor/tinyvec/Cargo.lock generated vendored Normal file
View File

@@ -0,0 +1,732 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "aho-corasick"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
dependencies = [
"memchr",
]
[[package]]
name = "anyhow"
version = "1.0.99"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b0674a1ddeecb70197781e945de4b3b8ffb61fa939a5597bcf48503737663100"
[[package]]
name = "arbitrary"
version = "1.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1"
[[package]]
name = "atty"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
dependencies = [
"hermit-abi",
"libc",
"winapi",
]
[[package]]
name = "autocfg"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
[[package]]
name = "bitflags"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "borsh"
version = "1.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad8646f98db542e39fc66e68a20b2144f6a732636df7c2354e74645faaa433ce"
dependencies = [
"cfg_aliases",
]
[[package]]
name = "bumpalo"
version = "3.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43"
[[package]]
name = "cast"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5"
[[package]]
name = "cfg-if"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268"
[[package]]
name = "cfg_aliases"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
[[package]]
name = "clap"
version = "2.34.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c"
dependencies = [
"bitflags",
"textwrap",
"unicode-width",
]
[[package]]
name = "criterion"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b01d6de93b2b6c65e17c634a26653a29d107b3c98c607c765bf38d041531cd8f"
dependencies = [
"atty",
"cast",
"clap",
"criterion-plot",
"csv",
"itertools",
"lazy_static",
"num-traits",
"oorandom",
"plotters",
"rayon",
"regex",
"serde",
"serde_cbor",
"serde_derive",
"serde_json",
"tinytemplate",
"walkdir",
]
[[package]]
name = "criterion-plot"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2673cc8207403546f45f5fd319a974b1e6983ad1a3ee7e6041650013be041876"
dependencies = [
"cast",
"itertools",
]
[[package]]
name = "crossbeam-deque"
version = "0.8.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51"
dependencies = [
"crossbeam-epoch",
"crossbeam-utils",
]
[[package]]
name = "crossbeam-epoch"
version = "0.9.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e"
dependencies = [
"crossbeam-utils",
]
[[package]]
name = "crossbeam-utils"
version = "0.8.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
[[package]]
name = "csv"
version = "1.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acdc4883a9c96732e4733212c01447ebd805833b7275a73ca3ee080fd77afdaf"
dependencies = [
"csv-core",
"itoa",
"ryu",
"serde",
]
[[package]]
name = "csv-core"
version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d02f3b0da4c6504f86e9cd789d8dbafab48c2321be74e9987593de5a894d93d"
dependencies = [
"memchr",
]
[[package]]
name = "debugger_test"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d95bb55f592fbb86947bee426d831de84bd65602a54f5cdcb10bfa70a62e52a0"
dependencies = [
"anyhow",
"log",
"quote",
"syn 1.0.109",
]
[[package]]
name = "debugger_test_parser"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ebe536452a777752b9316f0c840afbb94a2411684d4f15c081449ea801ef9e75"
dependencies = [
"anyhow",
"log",
"regex",
]
[[package]]
name = "either"
version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
[[package]]
name = "generic-array"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8c8444bc9d71b935156cc0ccab7f622180808af7867b1daae6547d773591703"
dependencies = [
"typenum",
]
[[package]]
name = "half"
version = "1.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b43ede17f21864e81be2fa654110bf1e793774238d86ef8555c37e6519c0403"
[[package]]
name = "hermit-abi"
version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
dependencies = [
"libc",
]
[[package]]
name = "itertools"
version = "0.10.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473"
dependencies = [
"either",
]
[[package]]
name = "itoa"
version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c"
[[package]]
name = "js-sys"
version = "0.3.77"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f"
dependencies = [
"once_cell",
"wasm-bindgen",
]
[[package]]
name = "lazy_static"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
[[package]]
name = "libc"
version = "0.2.175"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543"
[[package]]
name = "log"
version = "0.4.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
[[package]]
name = "memchr"
version = "2.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0"
[[package]]
name = "num-traits"
version = "0.2.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
dependencies = [
"autocfg",
]
[[package]]
name = "once_cell"
version = "1.21.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
[[package]]
name = "oorandom"
version = "11.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d6790f58c7ff633d8771f42965289203411a5e5c68388703c06e14f24770b41e"
[[package]]
name = "plotters"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5aeb6f403d7a4911efb1e33402027fc44f29b5bf6def3effcc22d7bb75f2b747"
dependencies = [
"num-traits",
"plotters-backend",
"plotters-svg",
"wasm-bindgen",
"web-sys",
]
[[package]]
name = "plotters-backend"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df42e13c12958a16b3f7f4386b9ab1f3e7933914ecea48da7139435263a4172a"
[[package]]
name = "plotters-svg"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51bae2ac328883f7acdfea3d66a7c35751187f870bc81f94563733a154d7a670"
dependencies = [
"plotters-backend",
]
[[package]]
name = "proc-macro2"
version = "1.0.101"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
dependencies = [
"proc-macro2",
]
[[package]]
name = "rayon"
version = "1.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f"
dependencies = [
"either",
"rayon-core",
]
[[package]]
name = "rayon-core"
version = "1.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91"
dependencies = [
"crossbeam-deque",
"crossbeam-utils",
]
[[package]]
name = "regex"
version = "1.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191"
dependencies = [
"aho-corasick",
"memchr",
"regex-automata",
"regex-syntax",
]
[[package]]
name = "regex-automata"
version = "0.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax",
]
[[package]]
name = "regex-syntax"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
[[package]]
name = "rustversion"
version = "1.0.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
[[package]]
name = "ryu"
version = "1.0.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f"
[[package]]
name = "same-file"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
dependencies = [
"winapi-util",
]
[[package]]
name = "serde"
version = "1.0.219"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_cbor"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2bef2ebfde456fb76bbcf9f59315333decc4fda0b2b44b420243c11e0f5ec1f5"
dependencies = [
"half",
"serde",
]
[[package]]
name = "serde_derive"
version = "1.0.219"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.106",
]
[[package]]
name = "serde_json"
version = "1.0.142"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "030fedb782600dcbd6f02d479bf0d817ac3bb40d644745b769d6a96bc3afc5a7"
dependencies = [
"itoa",
"memchr",
"ryu",
"serde",
]
[[package]]
name = "serde_test"
version = "1.0.177"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f901ee573cab6b3060453d2d5f0bae4e6d628c23c0a962ff9b5f1d7c8d4f1ed"
dependencies = [
"serde",
]
[[package]]
name = "smallvec"
version = "1.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
[[package]]
name = "syn"
version = "1.0.109"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "syn"
version = "2.0.106"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "textwrap"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
dependencies = [
"unicode-width",
]
[[package]]
name = "tinytemplate"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc"
dependencies = [
"serde",
"serde_json",
]
[[package]]
name = "tinyvec"
version = "1.10.0"
dependencies = [
"arbitrary",
"borsh",
"criterion",
"debugger_test",
"debugger_test_parser",
"generic-array",
"serde",
"serde_test",
"smallvec",
"tinyvec_macros",
]
[[package]]
name = "tinyvec_macros"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "typenum"
version = "1.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f"
[[package]]
name = "unicode-ident"
version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
[[package]]
name = "unicode-width"
version = "0.1.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af"
[[package]]
name = "walkdir"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b"
dependencies = [
"same-file",
"winapi-util",
]
[[package]]
name = "wasm-bindgen"
version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5"
dependencies = [
"cfg-if",
"once_cell",
"rustversion",
"wasm-bindgen-macro",
]
[[package]]
name = "wasm-bindgen-backend"
version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6"
dependencies = [
"bumpalo",
"log",
"proc-macro2",
"quote",
"syn 2.0.106",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
]
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.106",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d"
dependencies = [
"unicode-ident",
]
[[package]]
name = "web-sys"
version = "0.3.77"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2"
dependencies = [
"js-sys",
"wasm-bindgen",
]
[[package]]
name = "winapi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
dependencies = [
"winapi-i686-pc-windows-gnu",
"winapi-x86_64-pc-windows-gnu",
]
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-util"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
dependencies = [
"windows-sys",
]
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows-sys"
version = "0.59.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
dependencies = [
"windows-targets",
]
[[package]]
name = "windows-targets"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_gnullvm",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",
]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
[[package]]
name = "windows_aarch64_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
[[package]]
name = "windows_i686_gnu"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
[[package]]
name = "windows_i686_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
[[package]]
name = "windows_i686_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
[[package]]
name = "windows_x86_64_gnu"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
[[package]]
name = "windows_x86_64_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"

158
vendor/tinyvec/Cargo.toml vendored Normal file
View File

@@ -0,0 +1,158 @@
# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
#
# When uploading crates to the registry Cargo will automatically
# "normalize" Cargo.toml files for maximal compatibility
# with all versions of Cargo and also rewrite `path` dependencies
# to registry (e.g., crates.io) dependencies.
#
# If you are reading this file be aware that the original Cargo.toml
# will likely look very different (and much more reasonable).
# See Cargo.toml.orig for the original contents.
[package]
edition = "2018"
name = "tinyvec"
version = "1.10.0"
authors = ["Lokathor <zefria@gmail.com>"]
build = false
exclude = [
"/.github",
"/*.py",
"/*.sh",
"/src-backup",
]
autolib = false
autobins = false
autoexamples = false
autotests = false
autobenches = false
description = "`tinyvec` provides 100% safe vec-like data structures."
readme = "README.md"
keywords = [
"vec",
"no_std",
"no-std",
]
categories = [
"data-structures",
"no-std",
]
license = "Zlib OR Apache-2.0 OR MIT"
repository = "https://github.com/Lokathor/tinyvec"
[package.metadata.docs.rs]
features = [
"alloc",
"std",
"grab_spare_slice",
"latest_stable_rust",
"serde",
"borsh",
]
rustdoc-args = [
"--cfg",
"docs_rs",
]
[package.metadata.playground]
features = [
"alloc",
"std",
"grab_spare_slice",
"latest_stable_rust",
"serde",
"borsh",
]
[features]
alloc = ["tinyvec_macros"]
debugger_visualizer = []
default = []
experimental_write_impl = []
grab_spare_slice = []
latest_stable_rust = ["rustc_1_61"]
nightly_slice_partition_dedup = []
real_blackbox = ["criterion/real_blackbox"]
rustc_1_40 = []
rustc_1_55 = []
rustc_1_57 = []
rustc_1_61 = ["rustc_1_57"]
std = ["alloc"]
[lib]
name = "tinyvec"
path = "src/lib.rs"
[[test]]
name = "arrayvec"
path = "tests/arrayvec.rs"
[[test]]
name = "debugger_visualizer"
path = "tests/debugger_visualizer.rs"
test = false
required-features = ["debugger_visualizer"]
[[test]]
name = "tinyvec"
path = "tests/tinyvec.rs"
required-features = [
"alloc",
"std",
]
[[bench]]
name = "macros"
path = "benches/macros.rs"
harness = false
required-features = ["alloc"]
[[bench]]
name = "smallvec"
path = "benches/smallvec.rs"
harness = false
required-features = [
"alloc",
"real_blackbox",
]
[dependencies.arbitrary]
version = "1"
optional = true
[dependencies.borsh]
version = "1.2.0"
optional = true
default-features = false
[dependencies.generic-array]
version = "1.1.1"
optional = true
default-features = false
[dependencies.serde]
version = "1.0"
optional = true
default-features = false
[dependencies.tinyvec_macros]
version = "0.1"
optional = true
[dev-dependencies.criterion]
version = "0.3.0"
[dev-dependencies.debugger_test]
version = "0.1"
[dev-dependencies.debugger_test_parser]
version = "0.1"
[dev-dependencies.serde_test]
version = "1.0"
[dev-dependencies.smallvec]
version = "1"
[profile.bench]
debug = 2

202
vendor/tinyvec/LICENSE-APACHE.md vendored Normal file
View File

@@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

5
vendor/tinyvec/LICENSE-MIT.md vendored Normal file
View File

@@ -0,0 +1,5 @@
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

11
vendor/tinyvec/LICENSE-ZLIB.md vendored Normal file
View File

@@ -0,0 +1,11 @@
Copyright (c) 2019 Daniel "Lokathor" Gee.
This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.

34
vendor/tinyvec/README.md vendored Normal file
View File

@@ -0,0 +1,34 @@
[![License:Zlib](https://img.shields.io/badge/License-Zlib-brightgreen.svg)](https://opensource.org/licenses/Zlib)
![Minimum Rust Version](https://img.shields.io/badge/Min%20Rust-1.47-green.svg)
[![crates.io](https://img.shields.io/crates/v/tinyvec.svg)](https://crates.io/crates/tinyvec)
[![docs.rs](https://docs.rs/tinyvec/badge.svg)](https://docs.rs/tinyvec/)
![Unsafe-Zero-Percent](https://img.shields.io/badge/Unsafety-0%25-brightgreen.svg)
# tinyvec
A 100% safe crate of vec-like types.
Not just safe at the public API boundary, fully safe for all internal code too: `#![forbid(unsafe_code)]`
The provided types are as follows:
* `ArrayVec` is an array-backed vec-like data structure. It panics on overflow.
* `SliceVec` is similar, but using a `&mut [T]` as the data backing.
* `TinyVec` (`alloc` feature) is an enum that's either an `Inline(ArrayVec)` or a `Heap(Vec)`.
If a `TinyVec` is `Inline` and would overflow its array it automatically transitions to `Heap` and continues whatever it was doing.
To attain this "100% safe code" status there is one compromise: the element type of the vecs must implement `Default`.
For more API details, please see [the docs.rs documentation](https://docs.rs/tinyvec/)
## `tinyvec` Alternatives?
Maybe you don't want to use `tinyvec`, there's other crates you might use instead!
* [arrayvec](https://docs.rs/arrayvec) is a crate with array-backed structures.
* [smallvec](https://docs.rs/smallvec) is a crate where the array-backed data can be moved to the heap on overflow.
The main difference is that both of those crates use `unsafe` code.
This mostly allows them to get rid of the `Default` limitation for elements that `tinyvec` imposes.
The `smallvec` and `arrayvec` crates are generally correct, but there's been occasional bugs leading to UB.
With `tinyvec`, any uncaught bugs *can't* lead to UB, because the crate is safe code all the way through.
If you want that absolute level of assurance against UB, use `tinyvec`.

52
vendor/tinyvec/benches/macros.rs vendored Normal file
View File

@@ -0,0 +1,52 @@
use criterion::{criterion_group, criterion_main, Criterion};
use tinyvec::tiny_vec;
fn bench_tinyvec_macro(c: &mut Criterion) {
let mut g = c.benchmark_group("tinyvec_macro");
g.bench_function("0 of 32", |b| {
b.iter(|| tiny_vec!([u8; 32]));
});
g.bench_function("16 of 32", |b| {
b.iter(|| {
tiny_vec!([u8; 32]=>
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
)
});
});
g.bench_function("32 of 32", |b| {
b.iter(|| {
tiny_vec!([u8; 32]=>
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
)
});
});
g.bench_function("33 of 32", |b| {
b.iter(|| {
tiny_vec!([u8; 32]=>
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
33,
)
});
});
g.bench_function("64 of 32", |b| {
b.iter(|| {
tiny_vec!([u8; 32]=>
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
)
});
});
}
criterion_group!(benches, bench_tinyvec_macro);
criterion_main!(benches);

503
vendor/tinyvec/benches/smallvec.rs vendored Normal file
View File

@@ -0,0 +1,503 @@
//! Benchmarks that compare TinyVec to SmallVec
//!
//! All the following commentary is based on the latest nightly at the time:
//! rustc 1.55.0 (c8dfcfe04 2021-09-06).
//!
//! Some of these benchmarks are just a few instructions, so we put our own for
//! loop inside the criterion::Bencher::iter call. This seems to improve the
//! stability of measurements, and it has the wonderful side effect of making
//! the emitted assembly easier to follow. Some of these benchmarks are totally
//! inlined so that there are no calls at all in the hot path, so finding
//! this for loop is an easy way to find your way around the emitted assembly.
//!
//! The clear method is cheaper to call for arrays of elements without a Drop
//! impl, so wherever possible we reuse a single object in the benchmark loop,
//! with a clear + black_box on each iteration in an attempt to not make that
//! visible to the optimizer.
//!
//! We always call black_box(&v), instead of v = black_box(v) because the latter
//! does a move of the inline array, which is linear in the size of the array
//! and thus varies based on the array type being benchmarked, and this move can
//! be more expensive than the function we're trying to benchmark.
//!
//! We also black_box the input to each method call. This has a significant
//! effect on the assembly emitted, for example if we do not black_box the range
//! we iterate over in the ::push benchmarks, the loop is unrolled. It's not
//! entirely clear if it's better to black_box the iterator that yields the
//! items being pushed, or to black_box at a deeper level: v.push(black_box(i))
//! for example. Anecdotally, it seems like the latter approach produces
//! unreasonably bad assembly.
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use smallvec::SmallVec;
use std::iter::FromIterator;
use tinyvec::TinyVec;
const ITERS: usize = 10_000;
macro_rules! tinyvec_benches {
($c:expr, $type:ty ; $len:expr) => {{
let mut g = $c.benchmark_group(concat!(
"TinyVec_",
stringify!($type),
"_",
stringify!($len)
));
g.bench_function(
concat!(
"TinyVec<[",
stringify!($type),
"; ",
stringify!($len),
"]>::default"
),
|b| {
b.iter(|| {
for _ in 0..ITERS {
let v: TinyVec<[$type; $len]> = TinyVec::default();
black_box(&v);
}
});
},
);
g.bench_function(
concat!(
"TinyVec<[",
stringify!($type),
"; ",
stringify!($len),
"]>::clone"
),
|b| {
b.iter(|| {
let outer: TinyVec<[$type; $len]> =
black_box(TinyVec::from_iter(0..=($len as usize - 1) as _));
for _ in 0..ITERS {
let v = outer.clone();
black_box(&v);
}
});
},
);
g.bench_function(
concat!(
"TinyVec<[",
stringify!($type),
"; ",
stringify!($len),
"]>::clear"
),
|b| {
b.iter(|| {
let mut v: TinyVec<[$type; $len]> = TinyVec::default();
for _ in 0..ITERS {
v.clear();
black_box(&v);
}
});
},
);
g.bench_function(
concat!(
"TinyVec<[",
stringify!($type),
"; ",
stringify!($len),
"]>::push"
),
|b| {
b.iter(|| {
let mut v: TinyVec<[$type; $len]> = TinyVec::default();
for _ in 0..ITERS {
v.clear();
black_box(&v);
for i in black_box(0..=($len as usize - 1) as _) {
v.push(i);
}
black_box(&v);
}
});
},
);
g.bench_function(
concat!(
"TinyVec<[",
stringify!($type),
"; ",
stringify!($len),
"]>::from_iter"
),
|b| {
b.iter(|| {
for _ in 0..ITERS {
let v: TinyVec<[$type; $len]> =
TinyVec::from_iter(black_box(0..=($len as usize - 1) as _));
black_box(&v);
}
});
},
);
g.bench_function(
concat!(
"TinyVec<[",
stringify!($type),
"; ",
stringify!($len),
"]>::from_slice"
),
|b| {
b.iter(|| {
let data: &[$type] = &[0, 1, 2, 3, 4, 5, 6, 7];
for _ in 0..ITERS {
let v: TinyVec<[$type; $len]> = TinyVec::from(black_box(data));
black_box(&v);
}
});
},
);
g.bench_function(
concat!(
"TinyVec<[",
stringify!($type),
"; ",
stringify!($len),
"]>::extend"
),
|b| {
b.iter(|| {
let mut v: TinyVec<[$type; $len]> = black_box(TinyVec::default());
for _ in 0..ITERS {
v.clear();
black_box(&v);
v.extend(black_box(0..=($len as usize - 1) as _));
black_box(&v);
}
});
},
);
g.bench_function(
concat!(
"TinyVec<[",
stringify!($type),
"; ",
stringify!($len),
"]>::extend_from_slice"
),
|b| {
b.iter(|| {
let data: &[$type] = black_box(&[0, 1, 2, 3, 4, 5, 6, 7]);
let mut v: TinyVec<[$type; $len]> = black_box(TinyVec::default());
for _ in 0..ITERS {
v.clear();
black_box(&v);
v.extend_from_slice(data);
black_box(&v);
}
});
},
);
g.bench_function(
concat!(
"TinyVec<[",
stringify!($type),
"; ",
stringify!($len),
"]>::insert"
),
|b| {
b.iter(|| {
let mut v: TinyVec<[$type; $len]> = TinyVec::default();
for _ in 0..ITERS {
v.clear();
black_box(&v);
for i in black_box(0..=($len as usize - 1) as _) {
v.insert(i as usize, i);
}
black_box(&v);
}
});
},
);
g.bench_function(
concat!(
"TinyVec<[",
stringify!($type),
"; ",
stringify!($len),
"]>::remove"
),
|b| {
b.iter(|| {
let outer: TinyVec<[$type; $len]> =
black_box(TinyVec::from_iter(0..=($len as usize - 1) as _));
for _ in 0..ITERS {
let mut v = outer.clone();
for i in black_box((0..=($len as usize - 1) as _).rev()) {
v.remove(i);
}
black_box(&v);
}
});
},
);
}};
}
fn tinyvec_benches(c: &mut Criterion) {
tinyvec_benches!(c, u8; 8);
tinyvec_benches!(c, u8; 16);
tinyvec_benches!(c, u8; 32);
tinyvec_benches!(c, u8; 64);
tinyvec_benches!(c, u8; 128);
tinyvec_benches!(c, u8; 256);
tinyvec_benches!(c, u64; 2);
tinyvec_benches!(c, u64; 4);
tinyvec_benches!(c, u64; 8);
tinyvec_benches!(c, u64; 16);
tinyvec_benches!(c, u64; 32);
}
macro_rules! smallvec_benches {
($c:expr, $type:ty ; $len:expr) => {{
let mut g = $c.benchmark_group(concat!(
"SmallVec_",
stringify!($type),
"_",
stringify!($len)
));
g.bench_function(
concat!(
"SmallVec<[",
stringify!($type),
"; ",
stringify!($len),
"]>::default"
),
|b| {
b.iter(|| {
for _ in 0..ITERS {
let v: SmallVec<[$type; $len]> = SmallVec::default();
black_box(&v);
}
});
},
);
g.bench_function(
concat!(
"SmallVec<[",
stringify!($type),
"; ",
stringify!($len),
"]>::clone"
),
|b| {
b.iter(|| {
let outer: SmallVec<[$type; $len]> =
black_box(SmallVec::from_iter(0..=($len as usize - 1) as _));
for _ in 0..ITERS {
let v = outer.clone();
black_box(&v);
}
});
},
);
g.bench_function(
concat!(
"SmallVec<[",
stringify!($type),
"; ",
stringify!($len),
"]>::clear"
),
|b| {
b.iter(|| {
let mut v: SmallVec<[$type; $len]> = SmallVec::default();
for _ in 0..ITERS {
v.clear();
black_box(&v);
}
});
},
);
g.bench_function(
concat!(
"SmallVec<[",
stringify!($type),
"; ",
stringify!($len),
"]>::push"
),
|b| {
b.iter(|| {
let mut v: SmallVec<[$type; $len]> = SmallVec::default();
for _ in 0..ITERS {
v.clear();
black_box(&v);
for i in black_box(0..=($len as usize - 1) as _) {
v.push(i);
}
black_box(&v);
}
});
},
);
g.bench_function(
concat!(
"SmallVec<[",
stringify!($type),
"; ",
stringify!($len),
"]>::from_iter"
),
|b| {
b.iter(|| {
for _ in 0..ITERS {
let v: SmallVec<[$type; $len]> =
SmallVec::from_iter(black_box(0..=($len as usize - 1) as _));
black_box(&v);
}
});
},
);
g.bench_function(
concat!(
"SmallVec<[",
stringify!($type),
"; ",
stringify!($len),
"]>::from_slice"
),
|b| {
b.iter(|| {
let data: &[$type] = &[0, 1, 2, 3, 4, 5, 6, 7];
for _ in 0..ITERS {
let v: SmallVec<[$type; $len]> = SmallVec::from(black_box(data));
black_box(&v);
}
});
},
);
g.bench_function(
concat!(
"SmallVec<[",
stringify!($type),
"; ",
stringify!($len),
"]>::extend"
),
|b| {
b.iter(|| {
let mut v: SmallVec<[$type; $len]> = black_box(SmallVec::default());
for _ in 0..ITERS {
v.clear();
black_box(&v);
v.extend(black_box(0..=($len as usize - 1) as _));
black_box(&v);
}
});
},
);
g.bench_function(
concat!(
"SmallVec<[",
stringify!($type),
"; ",
stringify!($len),
"]>::extend_from_slice"
),
|b| {
b.iter(|| {
let data: &[$type] = black_box(&[0, 1, 2, 3, 4, 5, 6, 7]);
let mut v: SmallVec<[$type; $len]> = black_box(SmallVec::default());
for _ in 0..ITERS {
v.clear();
black_box(&v);
v.extend_from_slice(data);
black_box(&v);
}
});
},
);
g.bench_function(
concat!(
"SmallVec<[",
stringify!($type),
"; ",
stringify!($len),
"]>::insert"
),
|b| {
b.iter(|| {
let mut v: SmallVec<[$type; $len]> = SmallVec::default();
for _ in 0..ITERS {
v.clear();
black_box(&v);
for i in black_box(0..=($len as usize - 1) as _) {
v.insert(i as usize, i);
}
black_box(&v);
}
});
},
);
g.bench_function(
concat!(
"SmallVec<[",
stringify!($type),
"; ",
stringify!($len),
"]>::remove"
),
|b| {
b.iter(|| {
let outer: SmallVec<[$type; $len]> =
black_box(SmallVec::from_iter(0..=($len as usize - 1) as _));
for _ in 0..ITERS {
let mut v = outer.clone();
for i in black_box((0..=($len as usize - 1) as _).rev()) {
v.remove(i);
}
black_box(&v);
}
});
},
);
}};
}
fn smallvec_benches(c: &mut Criterion) {
smallvec_benches!(c, u8; 8);
smallvec_benches!(c, u8; 16);
smallvec_benches!(c, u8; 32);
smallvec_benches!(c, u8; 64);
smallvec_benches!(c, u8; 128);
smallvec_benches!(c, u8; 256);
smallvec_benches!(c, u64; 2);
smallvec_benches!(c, u64; 4);
smallvec_benches!(c, u64; 8);
smallvec_benches!(c, u64; 16);
smallvec_benches!(c, u64; 32);
}
criterion_group!(benches, tinyvec_benches, smallvec_benches);
criterion_main!(benches);

111
vendor/tinyvec/debug_metadata/README.md vendored Normal file
View File

@@ -0,0 +1,111 @@
## Debugger Visualizers
Many languages and debuggers enable developers to control how a type is
displayed in a debugger. These are called "debugger visualizations" or "debugger
views".
The Windows debuggers (WinDbg\CDB) support defining custom debugger visualizations using
the `Natvis` framework. To use Natvis, developers write XML documents using the natvis
schema that describe how debugger types should be displayed with the `.natvis` extension.
(See: https://docs.microsoft.com/en-us/visualstudio/debugger/create-custom-views-of-native-objects?view=vs-2019)
The Natvis files provide patterns which match type names a description of how to display
those types.
The Natvis schema can be found either online (See: https://code.visualstudio.com/docs/cpp/natvis#_schema)
or locally at `<VS Installation Folder>\Xml\Schemas\1033\natvis.xsd`.
The GNU debugger (GDB) supports defining custom debugger views using Pretty Printers.
Pretty printers are written as python scripts that describe how a type should be displayed
when loaded up in GDB/LLDB. (See: https://sourceware.org/gdb/onlinedocs/gdb/Pretty-Printing.html#Pretty-Printing)
The pretty printers provide patterns, which match type names, and for matching
types, describe how to display those types. (For writing a pretty printer, see: https://sourceware.org/gdb/onlinedocs/gdb/Writing-a-Pretty_002dPrinter.html#Writing-a-Pretty_002dPrinter).
### Embedding Visualizers
Through the use of the currently unstable `#[debugger_visualizer]` attribute, the `tinyvec`
crate can embed debugger visualizers into the crate metadata.
Currently the two types of visualizers supported are Natvis and Pretty printers.
For Natvis files, when linking an executable with a crate that includes Natvis files,
the MSVC linker will embed the contents of all Natvis files into the generated `PDB`.
For pretty printers, the compiler will encode the contents of the pretty printer
in the `.debug_gdb_scripts` section of the `ELF` generated.
### Testing Visualizers
The `tinyvec` crate supports testing debugger visualizers defined for this crate. The entry point for
these tests are `tests/debugger_visualizer.rs`. These tests are defined using the `debugger_test` and
`debugger_test_parser` crates. The `debugger_test` crate is a proc macro crate which defines a
single proc macro attribute, `#[debugger_test]`. For more detailed information about this crate,
see https://crates.io/crates/debugger_test. The CI pipeline for the `tinyvec` crate has been updated
to run the debugger visualizer tests to ensure debugger visualizers do not become broken/stale.
The `#[debugger_test]` proc macro attribute may only be used on test functions and will run the
function under the debugger specified by the `debugger` meta item.
This proc macro attribute has 3 required values:
1. The first required meta item, `debugger`, takes a string value which specifies the debugger to launch.
2. The second required meta item, `commands`, takes a string of new line (`\n`) separated list of debugger
commands to run.
3. The third required meta item, `expected_statements`, takes a string of new line (`\n`) separated list of
statements that must exist in the debugger output. Pattern matching through regular expressions is also
supported by using the `pattern:` prefix for each expected statement.
#### Example:
```rust
#[debugger_test(
debugger = "cdb",
commands = "command1\ncommand2\ncommand3",
expected_statements = "statement1\nstatement2\nstatement3")]
fn test() {
}
```
Using a multiline string is also supported, with a single debugger command/expected statement per line:
```rust
#[debugger_test(
debugger = "cdb",
commands = "
command1
command2
command3",
expected_statements = "
statement1
pattern:statement[0-9]+
statement3")]
fn test() {
}
```
In the example above, the second expected statement uses pattern matching through a regular expression
by using the `pattern:` prefix.
#### Testing Locally
Currently, only Natvis visualizations have been defined for the `tinyvec` crate via `debug_metadata/tinyvec.natvis`,
which means the `tests/debugger_visualizer.rs` tests need to be run on Windows using the `*-pc-windows-msvc` targets.
To run these tests locally, first ensure the debugging tools for Windows are installed or install them following
the steps listed here, [Debugging Tools for Windows](https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/).
Once the debugging tools have been installed, the tests can be run in the same manner as they are in the CI
pipeline.
#### Note
When running the debugger visualizer tests, `tests/debugger_visualizer.rs`, they need to be run consecutively
and not in parallel. This can be achieved by passing the flag `--test-threads=1` to rustc. This is due to
how the debugger tests are run. Each test marked with the `#[debugger_test]` attribute launches a debugger
and attaches it to the current test process. If tests are running in parallel, the test will try to attach
a debugger to the current process which may already have a debugger attached causing the test to fail.
For example:
```
cargo test --test debugger_visualizer --features debugger_visualizer -- --test-threads=1
```

View File

@@ -0,0 +1,24 @@
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<Type Name="tinyvec::arrayvec::ArrayVec&lt;array$&lt;*,*&gt;&gt;">
<DisplayString>{{ len={len} }}</DisplayString>
<Expand>
<Item Name="[len]">len</Item>
<Item Name="[capacity]">$T2</Item>
<ArrayItems>
<Size>len</Size>
<ValuePointer>($T1*)data</ValuePointer>
</ArrayItems>
</Expand>
</Type>
<Type Name="tinyvec::slicevec::SliceVec&lt;*&gt;">
<DisplayString>{{ len={len} }}</DisplayString>
<Expand>
<Item Name="[len]">len</Item>
<ArrayItems>
<Size>len</Size>
<ValuePointer>data.data_ptr</ValuePointer>
</ArrayItems>
</Expand>
</Type>
</AutoVisualizer>

14
vendor/tinyvec/rustfmt.toml vendored Normal file
View File

@@ -0,0 +1,14 @@
# Stable
edition = "2018"
fn_params_layout = "Compressed"
max_width = 80
tab_spaces = 2
use_field_init_shorthand = true
use_try_shorthand = true
use_small_heuristics = "Max"
# Unstable
format_code_in_doc_comments = true
wrap_comments = true
imports_granularity = "Crate"

46
vendor/tinyvec/src/array.rs vendored Normal file
View File

@@ -0,0 +1,46 @@
/// A trait for types that are an array.
///
/// An "array", for our purposes, has the following properties:
/// * Owns some number of elements.
/// * The element type can be generic, but must implement [`Default`].
/// * The capacity is fixed at compile time, based on the implementing type.
/// * You can get a shared or mutable slice to the elements.
///
/// You are generally **not** expected to need to implement this yourself. It is
/// already implemented for all array lengths.
///
/// **Additional lengths can easily be added upon request.**
///
/// ## Safety Reminder
///
/// Just a reminder: this trait is 100% safe, which means that `unsafe` code
/// **must not** rely on an instance of this trait being correct.
pub trait Array {
/// The type of the items in the thing.
type Item: Default;
/// The number of slots in the thing.
const CAPACITY: usize;
/// Gives a shared slice over the whole thing.
///
/// A correct implementation will return a slice with a length equal to the
/// `CAPACITY` value.
fn as_slice(&self) -> &[Self::Item];
/// Gives a unique slice over the whole thing.
///
/// A correct implementation will return a slice with a length equal to the
/// `CAPACITY` value.
fn as_slice_mut(&mut self) -> &mut [Self::Item];
/// Create a default-initialized instance of ourself, similar to the
/// [`Default`] trait, but implemented for the same range of sizes as
/// [`Array`].
fn default() -> Self;
}
mod const_generic_impl;
#[cfg(feature = "generic-array")]
mod generic_array_impl;

View File

@@ -0,0 +1,21 @@
use super::Array;
impl<T: Default, const N: usize> Array for [T; N] {
type Item = T;
const CAPACITY: usize = N;
#[inline(always)]
fn as_slice(&self) -> &[T] {
&*self
}
#[inline(always)]
fn as_slice_mut(&mut self) -> &mut [T] {
&mut *self
}
#[inline(always)]
fn default() -> Self {
[(); N].map(|_| Default::default())
}
}

View File

@@ -0,0 +1,24 @@
use core::default;
use super::Array;
use generic_array::{ArrayLength, GenericArray};
impl<T: Default, N: ArrayLength> Array for GenericArray<T, N> {
type Item = T;
const CAPACITY: usize = N::USIZE;
#[inline(always)]
fn as_slice(&self) -> &[T] {
&*self
}
#[inline(always)]
fn as_slice_mut(&mut self) -> &mut [T] {
&mut *self
}
#[inline(always)]
fn default() -> Self {
<Self as Default>::default()
}
}

2059
vendor/tinyvec/src/arrayvec.rs vendored Normal file

File diff suppressed because it is too large Load Diff

99
vendor/tinyvec/src/arrayvec_drain.rs vendored Normal file
View File

@@ -0,0 +1,99 @@
use super::*;
use core::{
ops::{Bound, RangeBounds},
slice,
};
/// Draining iterator for [`ArrayVec`]
///
/// See [`ArrayVec::drain`](ArrayVec::drain)
pub struct ArrayVecDrain<'a, T: 'a + Default> {
iter: slice::IterMut<'a, T>,
}
impl<'a, T: 'a + Default> ArrayVecDrain<'a, T> {
pub(crate) fn new<A, R>(arr: &'a mut ArrayVec<A>, range: R) -> Self
where
A: Array<Item = T>,
R: RangeBounds<usize>,
{
let start = match range.start_bound() {
Bound::Unbounded => 0,
Bound::Included(&n) => n,
Bound::Excluded(&n) => n.saturating_add(1),
};
let end = match range.end_bound() {
Bound::Unbounded => arr.len(),
Bound::Included(&n) => n.saturating_add(1),
Bound::Excluded(&n) => n,
};
assert!(
start <= end,
"ArrayVec::drain> Illegal range, {} to {}",
start,
end
);
assert!(
end <= arr.len(),
"ArrayVec::drain> Range ends at {}, but length is only {}",
end,
arr.len()
);
let len = end - start;
let to_rotate = &mut arr[start..];
to_rotate.rotate_left(len);
let oldlen = arr.len();
let newlen = oldlen - len;
arr.set_len(newlen);
let slice = &mut arr.data.as_slice_mut()[newlen..oldlen];
let iter = slice.iter_mut();
Self { iter }
}
}
impl<'a, T: 'a + Default> DoubleEndedIterator for ArrayVecDrain<'a, T> {
#[inline]
fn next_back(&mut self) -> Option<Self::Item> {
self.iter.next_back().map(core::mem::take)
}
#[inline]
fn nth_back(&mut self, n: usize) -> Option<Self::Item> {
self.iter.nth_back(n).map(core::mem::take)
}
}
impl<'a, T: 'a + Default> Iterator for ArrayVecDrain<'a, T> {
type Item = T;
#[inline]
fn next(&mut self) -> Option<Self::Item> {
self.iter.next().map(core::mem::take)
}
#[inline]
fn size_hint(&self) -> (usize, Option<usize>) {
self.iter.size_hint()
}
#[inline]
fn nth(&mut self, n: usize) -> Option<Self::Item> {
self.iter.nth(n).map(core::mem::take)
}
#[inline]
fn last(self) -> Option<Self::Item> {
self.iter.last().map(core::mem::take)
}
#[inline]
fn for_each<F>(self, f: F)
where
F: FnMut(Self::Item),
{
self.iter.map(core::mem::take).for_each(f)
}
}
impl<'a, T: 'a + Default> FusedIterator for ArrayVecDrain<'a, T> {}
impl<'a, T: 'a + Default> ExactSizeIterator for ArrayVecDrain<'a, T> {}
/* No need to impl Drop! */

103
vendor/tinyvec/src/lib.rs vendored Normal file
View File

@@ -0,0 +1,103 @@
#![cfg_attr(not(feature = "std"), no_std)]
#![forbid(unsafe_code)]
#![cfg_attr(
feature = "nightly_slice_partition_dedup",
feature(slice_partition_dedup)
)]
#![cfg_attr(
feature = "debugger_visualizer",
feature(debugger_visualizer),
debugger_visualizer(natvis_file = "../debug_metadata/tinyvec.natvis")
)]
#![cfg_attr(docsrs, feature(doc_cfg))]
#![warn(clippy::missing_inline_in_public_items)]
#![warn(clippy::must_use_candidate)]
#![warn(missing_docs)]
#![allow(clippy::borrow_deref_ref)]
#![allow(unused_imports)]
#![allow(unused_mut)]
#![allow(clippy::write_with_newline)]
#![allow(clippy::needless_return)]
//! `tinyvec` provides 100% safe vec-like data structures.
//!
//! ## Provided Types
//! With no features enabled, this crate provides the [`ArrayVec`] type, which
//! is an array-backed storage. You can push values into the array and pop them
//! out of the array and so on. If the array is made to overflow it will panic.
//!
//! Similarly, there is also a [`SliceVec`] type available, which is a vec-like
//! that's backed by a slice you provide. You can add and remove elements, but
//! if you overflow the slice it will panic.
//!
//! With the `alloc` feature enabled, the crate also has a [`TinyVec`] type.
//! This is an enum type which is either an `Inline(ArrayVec)` or a `Heap(Vec)`.
//! If a `TinyVec` is `Inline` and would overflow it automatically transitions
//! itself into being `Heap` mode instead of a panic.
//!
//! All of this is done with no `unsafe` code within the crate. Technically the
//! `Vec` type from the standard library uses `unsafe` internally, but *this
//! crate* introduces no new `unsafe` code into your project.
//!
//! The limitation is that the element type of a vec from this crate must
//! support the [`Default`] trait. This means that this crate isn't suitable for
//! all situations, but a very surprising number of types do support `Default`.
//!
//! ## Other Features
//! * `grab_spare_slice` lets you get access to the "inactive" portions of an
//! ArrayVec.
//! * `serde` provides a `Serialize` and `Deserialize` implementation for
//! [`TinyVec`] and [`ArrayVec`] types, provided the inner item also has an
//! implementation.
//! * `borsh` provides a `BorshSerialize` and `BorshDeserialize` implementation
//! for [`TinyVec`] and [`ArrayVec`] types, provided the inner item also has
//! an implementation.
//!
//! ## API
//! The general goal of the crate is that, as much as possible, the vecs here
//! should be a "drop in" replacement for the standard library `Vec` type. We
//! strive to provide all of the `Vec` methods with the same names and
//! signatures. The exception is that the element type of some methods will have
//! a `Default` bound that's not part of the normal `Vec` type.
//!
//! The vecs here also have a few additional methods that aren't on the `Vec`
//! type. In this case, the names tend to be fairly long so that they are
//! unlikely to clash with any future methods added to `Vec`.
#[allow(unused_imports)]
use core::{
borrow::{Borrow, BorrowMut},
cmp::PartialEq,
convert::AsMut,
default::Default,
fmt::{
Binary, Debug, Display, Formatter, LowerExp, LowerHex, Octal, Pointer,
UpperExp, UpperHex,
},
hash::{Hash, Hasher},
iter::{Extend, FromIterator, FusedIterator, IntoIterator, Iterator},
mem::{needs_drop, replace},
ops::{Deref, DerefMut, Index, IndexMut, RangeBounds},
slice::SliceIndex,
};
#[cfg(feature = "alloc")]
#[doc(hidden)] // re-export for macros
pub extern crate alloc;
mod array;
pub use array::*;
mod arrayvec;
pub use arrayvec::*;
mod arrayvec_drain;
pub use arrayvec_drain::*;
mod slicevec;
pub use slicevec::*;
#[cfg(feature = "alloc")]
mod tinyvec;
#[cfg(feature = "alloc")]
pub use crate::tinyvec::*;

1069
vendor/tinyvec/src/slicevec.rs vendored Normal file

File diff suppressed because it is too large Load Diff

1889
vendor/tinyvec/src/tinyvec.rs vendored Normal file

File diff suppressed because it is too large Load Diff

500
vendor/tinyvec/tests/arrayvec.rs vendored Normal file
View File

@@ -0,0 +1,500 @@
#![allow(bad_style)]
#![allow(clippy::clone_on_copy)]
#[cfg(feature = "serde")]
use serde_test::{assert_tokens, Token};
use std::iter::FromIterator;
use tinyvec::*;
#[test]
fn test_a_vec() {
let mut expected: ArrayVec<[i32; 4]> = Default::default();
expected.push(1);
expected.push(2);
expected.push(3);
let actual = array_vec!(1, 2, 3);
assert_eq!(expected, actual);
assert_eq!(array_vec![0u8; 4], array_vec!(0u8, 0u8, 0u8, 0u8));
assert_eq!(array_vec![0u8; 4], array_vec!([u8; 4] => 0, 0, 0, 0));
assert_eq!(array_vec![0; 4], array_vec!(0, 0, 0, 0));
assert_eq!(array_vec![0; 4], array_vec!([u8; 4] => 0, 0, 0, 0));
let expected2 = array_vec![1.1; 3];
let actual2 = array_vec!([f32; 3] => 1.1, 1.1, 1.1);
assert_eq!(expected2, actual2);
}
#[test]
fn ArrayVec_push_pop() {
let mut av: ArrayVec<[i32; 4]> = Default::default();
assert_eq!(av.len(), 0);
assert_eq!(av.pop(), None);
av.push(10_i32);
assert_eq!(av.len(), 1);
assert_eq!(av[0], 10);
assert_eq!(av.pop(), Some(10));
assert_eq!(av.len(), 0);
assert_eq!(av.pop(), None);
av.push(10);
av.push(11);
av.push(12);
av.push(13);
assert_eq!(av[0], 10);
assert_eq!(av[1], 11);
assert_eq!(av[2], 12);
assert_eq!(av[3], 13);
assert_eq!(av.len(), 4);
assert_eq!(av.pop(), Some(13));
assert_eq!(av.len(), 3);
assert_eq!(av.pop(), Some(12));
assert_eq!(av.len(), 2);
assert_eq!(av.pop(), Some(11));
assert_eq!(av.len(), 1);
assert_eq!(av.pop(), Some(10));
assert_eq!(av.len(), 0);
assert_eq!(av.pop(), None);
}
#[test]
#[should_panic]
fn ArrayVec_push_overflow() {
let mut av: ArrayVec<[i32; 0]> = Default::default();
av.push(7);
}
#[test]
fn ArrayVec_formatting() {
// check that we get the comma placement correct
let mut av: ArrayVec<[i32; 4]> = Default::default();
assert_eq!(format!("{:?}", av), "[]");
av.push(10);
assert_eq!(format!("{:?}", av), "[10]");
av.push(11);
assert_eq!(format!("{:?}", av), "[10, 11]");
av.push(12);
assert_eq!(format!("{:?}", av), "[10, 11, 12]");
// below here just asserts that the impls exist.
//
let av: ArrayVec<[i32; 4]> = Default::default();
assert_eq!(format!("{:b}", av), "[]");
assert_eq!(format!("{:o}", av), "[]");
assert_eq!(format!("{:x}", av), "[]");
assert_eq!(format!("{:X}", av), "[]");
assert_eq!(format!("{}", av), "[]");
//
let av: ArrayVec<[f32; 4]> = Default::default();
assert_eq!(format!("{:e}", av), "[]");
assert_eq!(format!("{:E}", av), "[]");
//
let av: ArrayVec<[&'static str; 4]> = Default::default();
assert_eq!(format!("{:p}", av), "[]");
}
#[test]
fn ArrayVec_iteration() {
let av = array_vec!([i32; 4] => 10, 11, 12, 13);
let mut i = av.into_iter();
assert_eq!(i.next(), Some(10));
assert_eq!(i.next(), Some(11));
assert_eq!(i.next(), Some(12));
assert_eq!(i.next(), Some(13));
assert_eq!(i.next(), None);
let av = array_vec!([i32; 4] => 10, 11, 12, 13);
let mut av2: ArrayVec<[i32; 4]> = av.clone().into_iter().collect();
assert_eq!(av, av2);
// IntoIterator for &mut ArrayVec
for x in &mut av2 {
*x = -*x;
}
// IntoIterator for &ArrayVec
assert!(av.iter().zip(&av2).all(|(&a, &b)| a == -b));
}
#[test]
fn ArrayVec_append() {
let mut av = array_vec!([i32; 8] => 1, 2, 3);
let mut av2 = array_vec!([i32; 8] => 4, 5, 6);
//
av.append(&mut av2);
assert_eq!(av.as_slice(), &[1_i32, 2, 3, 4, 5, 6]);
assert_eq!(av2.as_slice(), &[]);
}
#[test]
fn ArrayVec_remove() {
let mut av: ArrayVec<[i32; 10]> = Default::default();
av.push(1);
av.push(2);
av.push(3);
assert_eq!(av.remove(1), 2);
assert_eq!(&av[..], &[1, 3][..]);
}
#[test]
#[should_panic]
fn ArrayVec_remove_invalid() {
let mut av: ArrayVec<[i32; 1]> = Default::default();
av.push(1);
av.remove(1);
}
#[test]
fn ArrayVec_swap_remove() {
let mut av: ArrayVec<[i32; 10]> = Default::default();
av.push(1);
av.push(2);
av.push(3);
av.push(4);
assert_eq!(av.swap_remove(3), 4);
assert_eq!(&av[..], &[1, 2, 3][..]);
assert_eq!(av.swap_remove(0), 1);
assert_eq!(&av[..], &[3, 2][..]);
assert_eq!(av.swap_remove(0), 3);
assert_eq!(&av[..], &[2][..]);
assert_eq!(av.swap_remove(0), 2);
assert_eq!(&av[..], &[][..]);
}
#[test]
fn ArrayVec_drain() {
let mut av: ArrayVec<[i32; 10]> = Default::default();
av.push(1);
av.push(2);
av.push(3);
assert_eq!(Vec::from_iter(av.clone().drain(..)), vec![1, 2, 3]);
assert_eq!(Vec::from_iter(av.clone().drain(..2)), vec![1, 2]);
assert_eq!(Vec::from_iter(av.clone().drain(..3)), vec![1, 2, 3]);
assert_eq!(Vec::from_iter(av.clone().drain(..=1)), vec![1, 2]);
assert_eq!(Vec::from_iter(av.clone().drain(..=2)), vec![1, 2, 3]);
assert_eq!(Vec::from_iter(av.clone().drain(0..)), vec![1, 2, 3]);
assert_eq!(Vec::from_iter(av.clone().drain(1..)), vec![2, 3]);
assert_eq!(Vec::from_iter(av.clone().drain(0..2)), vec![1, 2]);
assert_eq!(Vec::from_iter(av.clone().drain(0..3)), vec![1, 2, 3]);
assert_eq!(Vec::from_iter(av.clone().drain(1..2)), vec![2]);
assert_eq!(Vec::from_iter(av.clone().drain(1..3)), vec![2, 3]);
assert_eq!(Vec::from_iter(av.clone().drain(0..=1)), vec![1, 2]);
assert_eq!(Vec::from_iter(av.clone().drain(0..=2)), vec![1, 2, 3]);
assert_eq!(Vec::from_iter(av.clone().drain(1..=1)), vec![2]);
assert_eq!(Vec::from_iter(av.clone().drain(1..=2)), vec![2, 3]);
}
#[test]
fn ArrayVec_splice() {
let mut av: ArrayVec<[i32; 10]> = Default::default();
av.push(1);
av.push(2);
av.push(3);
// splice returns the same things as drain
assert_eq!(Vec::from_iter(av.clone().splice(.., None)), vec![1, 2, 3]);
assert_eq!(Vec::from_iter(av.clone().splice(..2, None)), vec![1, 2]);
assert_eq!(Vec::from_iter(av.clone().splice(..3, None)), vec![1, 2, 3]);
assert_eq!(Vec::from_iter(av.clone().splice(..=1, None)), vec![1, 2]);
assert_eq!(Vec::from_iter(av.clone().splice(..=2, None)), vec![1, 2, 3]);
assert_eq!(Vec::from_iter(av.clone().splice(0.., None)), vec![1, 2, 3]);
assert_eq!(Vec::from_iter(av.clone().splice(1.., None)), vec![2, 3]);
assert_eq!(Vec::from_iter(av.clone().splice(0..2, None)), vec![1, 2]);
assert_eq!(Vec::from_iter(av.clone().splice(0..3, None)), vec![1, 2, 3]);
assert_eq!(Vec::from_iter(av.clone().splice(1..2, None)), vec![2]);
assert_eq!(Vec::from_iter(av.clone().splice(1..3, None)), vec![2, 3]);
assert_eq!(Vec::from_iter(av.clone().splice(0..=1, None)), vec![1, 2]);
assert_eq!(Vec::from_iter(av.clone().splice(0..=2, None)), vec![1, 2, 3]);
assert_eq!(Vec::from_iter(av.clone().splice(1..=1, None)), vec![2]);
assert_eq!(Vec::from_iter(av.clone().splice(1..=2, None)), vec![2, 3]);
// splice removes the same things as drain
let mut av2 = av.clone();
av2.splice(.., None);
assert_eq!(av2, array_vec![]);
let mut av2 = av.clone();
av2.splice(..2, None);
assert_eq!(av2, array_vec![3]);
let mut av2 = av.clone();
av2.splice(..3, None);
assert_eq!(av2, array_vec![]);
let mut av2 = av.clone();
av2.splice(..=1, None);
assert_eq!(av2, array_vec![3]);
let mut av2 = av.clone();
av2.splice(..=2, None);
assert_eq!(av2, array_vec![]);
let mut av2 = av.clone();
av2.splice(0.., None);
assert_eq!(av2, array_vec![]);
let mut av2 = av.clone();
av2.splice(1.., None);
assert_eq!(av2, array_vec![1]);
let mut av2 = av.clone();
av2.splice(0..2, None);
assert_eq!(av2, array_vec![3]);
let mut av2 = av.clone();
av2.splice(0..3, None);
assert_eq!(av2, array_vec![]);
let mut av2 = av.clone();
av2.splice(1..2, None);
assert_eq!(av2, array_vec![1, 3]);
let mut av2 = av.clone();
av2.splice(1..3, None);
assert_eq!(av2, array_vec![1]);
let mut av2 = av.clone();
av2.splice(0..=1, None);
assert_eq!(av2, array_vec![3]);
let mut av2 = av.clone();
av2.splice(0..=2, None);
assert_eq!(av2, array_vec![]);
let mut av2 = av.clone();
av2.splice(1..=1, None);
assert_eq!(av2, array_vec![1, 3]);
let mut av2 = av.clone();
av2.splice(1..=2, None);
assert_eq!(av2, array_vec![1]);
// splice adds the elements correctly
let mut av2 = av.clone();
av2.splice(.., 4..=6);
assert_eq!(av2, array_vec![4, 5, 6]);
let mut av2 = av.clone();
av2.splice(..2, 4..=6);
assert_eq!(av2, array_vec![4, 5, 6, 3]);
let mut av2 = av.clone();
av2.splice(..3, 4..=6);
assert_eq!(av2, array_vec![4, 5, 6]);
let mut av2 = av.clone();
av2.splice(..=1, 4..=6);
assert_eq!(av2, array_vec![4, 5, 6, 3]);
let mut av2 = av.clone();
av2.splice(..=2, 4..=6);
assert_eq!(av2, array_vec![4, 5, 6]);
let mut av2 = av.clone();
av2.splice(0.., 4..=6);
assert_eq!(av2, array_vec![4, 5, 6]);
let mut av2 = av.clone();
av2.splice(1.., 4..=6);
assert_eq!(av2, array_vec![1, 4, 5, 6]);
let mut av2 = av.clone();
av2.splice(0..2, 4..=6);
assert_eq!(av2, array_vec![4, 5, 6, 3]);
let mut av2 = av.clone();
av2.splice(0..3, 4..=6);
assert_eq!(av2, array_vec![4, 5, 6]);
let mut av2 = av.clone();
av2.splice(1..2, 4..=6);
assert_eq!(av2, array_vec![1, 4, 5, 6, 3]);
let mut av2 = av.clone();
av2.splice(1..3, 4..=6);
assert_eq!(av2, array_vec![1, 4, 5, 6]);
let mut av2 = av.clone();
av2.splice(0..=1, 4..=6);
assert_eq!(av2, array_vec![4, 5, 6, 3]);
let mut av2 = av.clone();
av2.splice(0..=2, 4..=6);
assert_eq!(av2, array_vec![4, 5, 6]);
let mut av2 = av.clone();
av2.splice(1..=1, 4..=6);
assert_eq!(av2, array_vec![1, 4, 5, 6, 3]);
let mut av2 = av.clone();
av2.splice(1..=2, 4..=6);
assert_eq!(av2, array_vec![1, 4, 5, 6]);
// splice adds the elements correctly when the replacement is smaller
let mut av2 = av.clone();
av2.splice(.., Some(4));
assert_eq!(av2, array_vec![4]);
let mut av2 = av.clone();
av2.splice(..2, Some(4));
assert_eq!(av2, array_vec![4, 3]);
let mut av2 = av.clone();
av2.splice(1.., Some(4));
assert_eq!(av2, array_vec![1, 4]);
let mut av2 = av.clone();
av2.splice(1..=1, Some(4));
assert_eq!(av2, array_vec![1, 4, 3]);
}
#[test]
fn iter_last_nth() {
let mut av: ArrayVec<[i32; 10]> = Default::default();
av.push(1);
av.push(2);
av.push(3);
av.push(4);
assert_eq!(av.len(), 4);
let mut iter = av.into_iter();
assert_eq!(iter.next(), Some(1));
assert_eq!(iter.next(), Some(2));
assert_eq!(iter.next(), Some(3));
assert_eq!(iter.next(), Some(4));
assert_eq!(iter.next(), None);
assert_eq!(iter.last(), None);
let mut av: ArrayVec<[i32; 10]> = Default::default();
av.push(1);
av.push(2);
av.push(3);
assert_eq!(av.into_iter().next(), Some(1));
}
#[test]
#[cfg(feature = "rustc_1_40")]
fn reviter() {
let mut av: ArrayVec<[i32; 10]> = Default::default();
av.push(1);
av.push(2);
av.push(3);
av.push(4);
let mut iter = av.into_iter();
assert_eq!(iter.next(), Some(1));
assert_eq!(iter.next_back(), Some(4));
assert_eq!(iter.next(), Some(2));
assert_eq!(iter.next_back(), Some(3));
assert_eq!(iter.next(), None);
assert_eq!(iter.next_back(), None);
let mut av: ArrayVec<[i32; 32]> = Default::default();
av.extend(0..32);
let mut iter = av.into_iter();
assert_eq!(iter.nth_back(0), Some(31));
assert_eq!(iter.nth_back(2), Some(28));
assert_eq!(iter.nth_back(0), Some(27));
assert_eq!(iter.nth_back(99), None);
assert_eq!(iter.nth_back(99), None);
}
#[cfg(feature = "serde")]
#[test]
fn ArrayVec_ser_de_empty() {
let tv: ArrayVec<[i32; 0]> = Default::default();
assert_tokens(&tv, &[Token::Seq { len: Some(0) }, Token::SeqEnd]);
}
#[cfg(feature = "serde")]
#[test]
fn ArrayVec_ser_de() {
let mut tv: ArrayVec<[i32; 4]> = Default::default();
tv.push(1);
tv.push(2);
tv.push(3);
tv.push(4);
assert_tokens(
&tv,
&[
Token::Seq { len: Some(4) },
Token::I32(1),
Token::I32(2),
Token::I32(3),
Token::I32(4),
Token::SeqEnd,
],
);
}
#[cfg(feature = "borsh")]
#[test]
fn ArrayVec_borsh_de_empty() {
let tv: ArrayVec<[i32; 0]> = Default::default();
let buffer = borsh::to_vec(&tv).unwrap();
let des: ArrayVec<[i32; 0]> = borsh::from_slice(&buffer).unwrap();
assert_eq!(tv, des);
}
#[cfg(feature = "borsh")]
#[test]
fn ArrayVec_borsh_de() {
let mut tv: ArrayVec<[i32; 4]> = Default::default();
tv.push(1);
tv.push(2);
tv.push(3);
tv.push(4);
let buffer = borsh::to_vec(&tv).unwrap();
let des: ArrayVec<[i32; 4]> = borsh::from_slice(&buffer).unwrap();
assert_eq!(tv, des);
}
#[test]
fn ArrayVec_try_from_slice() {
use std::convert::TryFrom;
let nums = [1, 2, 3, 4];
let empty: Result<ArrayVec<[i32; 2]>, _> = ArrayVec::try_from(&nums[..0]);
assert!(empty.is_ok());
assert_eq!(empty.unwrap().as_slice(), &[]);
let fits: Result<ArrayVec<[i32; 2]>, _> = ArrayVec::try_from(&nums[..2]);
assert!(fits.is_ok());
assert_eq!(fits.unwrap().as_slice(), &[1, 2]);
let does_not_fit: Result<ArrayVec<[i32; 2]>, _> =
ArrayVec::try_from(&nums[..4]);
assert!(does_not_fit.is_err());
}
#[test]
fn ArrayVec_pretty_debug() {
let arr: [i32; 3] = [1, 2, 3];
let expect = format!("{:#?}", arr);
let arr: ArrayVec<[i32; 3]> = array_vec![1, 2, 3];
let got = format!("{:#?}", arr);
assert_eq!(got, expect);
}

View File

@@ -0,0 +1,91 @@
use debugger_test::debugger_test;
use tinyvec::*;
#[inline(never)]
fn __break() {
println!("breakpoint hit");
}
#[debugger_test(
debugger = "cdb",
commands = r#"
dx strings
dx inline_tv
dx inline_tv.__0
g
dx slice_vec
g
dx strings
"#,
expected_statements = r#"
pattern:strings : \{ len=0x3 \} \[Type: tinyvec::arrayvec::ArrayVec<array\$<.*str.*,7> >\]
pattern:\[<Raw View>\] \[Type: tinyvec::arrayvec::ArrayVec<array\$<.*str.*,7> >\]
pattern:\[len\] : 0x3 \[Type: unsigned short\]
pattern:\[capacity\] : 7
pattern:\[0\] : "a" \[Type: .*str.*\]
pattern:\[1\] : "b" \[Type: .*str.*\]
pattern:\[2\] : "c" \[Type: .*str.*\]
inline_tv : Inline [Type: enum2$<tinyvec::tinyvec::TinyVec<array$<i32,4> > >]
[<Raw View>] [Type: enum2$<tinyvec::tinyvec::TinyVec<array$<i32,4> > >]
[+0x004] __0 : { len=0x4 } [Type: tinyvec::arrayvec::ArrayVec<array$<i32,4> >]
inline_tv.__0 : { len=0x4 } [Type: tinyvec::arrayvec::ArrayVec<array$<i32,4> >]
[<Raw View>] [Type: tinyvec::arrayvec::ArrayVec<array$<i32,4> >]
[len] : 0x4 [Type: unsigned short]
[capacity] : 4
[0] : 1 [Type: i32]
[1] : 2 [Type: i32]
[2] : 3 [Type: i32]
[3] : 4 [Type: i32]
pattern:slice_vec : \{ len=0x3 \} \[Type: tinyvec::slicevec::SliceVec<.*str.*>\]
pattern:\[<Raw View>\] \[Type: tinyvec::slicevec::SliceVec<.*str.*>\]
pattern:\[len\] : 0x3 \[Type: unsigned __int64\]
pattern:\[0\] : "a" \[Type: .*str.*\]
pattern:\[1\] : "b" \[Type: .*str.*\]
pattern:\[2\] : "d" \[Type: .*str.*\]
pattern:strings : \{ len=0x6 \} \[Type: tinyvec::arrayvec::ArrayVec<array\$<.*str.*,7> >\]
pattern:\[<Raw View>\] \[Type: tinyvec::arrayvec::ArrayVec<array\$<.*str.*,7> >\]
pattern:\[len\] : 0x6 \[Type: unsigned short\]
pattern:\[capacity\] : 7
pattern:\[0\] : "a" \[Type: .*str.*\]
pattern:\[1\] : "b" \[Type: .*str.*\]
pattern:\[2\] : "d" \[Type: .*str.*\]
pattern:\[3\] : "e" \[Type: .*str.*\]
pattern:\[4\] : "f" \[Type: .*str.*\]
pattern:\[5\] : "g" \[Type: .*str.*\]
"#
)]
#[inline(never)]
fn test_debugger_visualizer() {
let mut strings = ArrayVec::<[&str; 7]>::default();
strings.push("a");
strings.push("b");
strings.push("c");
assert_eq!(["a", "b", "c"], &strings[..]);
let mut inline_tv = tiny_vec!([i32; 4] => 1, 2, 3);
assert!(inline_tv.is_inline());
inline_tv.push(4);
__break();
{
let mut slice_vec = SliceVec::from(strings.as_mut_slice());
assert_eq!(3, slice_vec.capacity());
assert_eq!("c", slice_vec.remove(2));
slice_vec.push("d");
println!("{:?}", slice_vec);
__break();
assert_eq!(["a", "b", "d"], &slice_vec[..]);
}
strings.push("e");
strings.push("f");
strings.push("g");
assert_eq!(["a", "b", "d", "e", "f", "g"], &strings[..]);
__break();
}

501
vendor/tinyvec/tests/tinyvec.rs vendored Normal file
View File

@@ -0,0 +1,501 @@
#![cfg(feature = "alloc")]
#![allow(bad_style)]
#![allow(clippy::redundant_clone)]
#[cfg(feature = "serde")]
use serde_test::{assert_tokens, Token};
use std::iter::FromIterator;
use tinyvec::*;
#[test]
fn TinyVec_swap_remove() {
let mut tv: TinyVec<[i32; 10]> = Default::default();
tv.push(1);
tv.push(2);
tv.push(3);
tv.push(4);
assert_eq!(tv.swap_remove(3), 4);
assert_eq!(&tv[..], &[1, 2, 3][..]);
assert_eq!(tv.swap_remove(0), 1);
assert_eq!(&tv[..], &[3, 2][..]);
assert_eq!(tv.swap_remove(0), 3);
assert_eq!(&tv[..], &[2][..]);
assert_eq!(tv.swap_remove(0), 2);
assert_eq!(&tv[..], &[][..]);
}
#[test]
fn TinyVec_capacity() {
let mut tv: TinyVec<[i32; 1]> = Default::default();
assert_eq!(tv.capacity(), 1);
tv.move_to_the_heap();
tv.extend_from_slice(&[1, 2, 3, 4]);
assert_eq!(tv.capacity(), 4);
}
#[test]
fn TinyVec_drain() {
let mut tv: TinyVec<[i32; 10]> = Default::default();
tv.push(1);
tv.push(2);
tv.push(3);
assert_eq!(Vec::from_iter(tv.clone().drain(..)), vec![1, 2, 3]);
assert_eq!(Vec::from_iter(tv.clone().drain(..2)), vec![1, 2]);
assert_eq!(Vec::from_iter(tv.clone().drain(..3)), vec![1, 2, 3]);
assert_eq!(Vec::from_iter(tv.clone().drain(..=1)), vec![1, 2]);
assert_eq!(Vec::from_iter(tv.clone().drain(..=2)), vec![1, 2, 3]);
assert_eq!(Vec::from_iter(tv.clone().drain(0..)), vec![1, 2, 3]);
assert_eq!(Vec::from_iter(tv.clone().drain(1..)), vec![2, 3]);
assert_eq!(Vec::from_iter(tv.clone().drain(0..2)), vec![1, 2]);
assert_eq!(Vec::from_iter(tv.clone().drain(0..3)), vec![1, 2, 3]);
assert_eq!(Vec::from_iter(tv.clone().drain(1..2)), vec![2]);
assert_eq!(Vec::from_iter(tv.clone().drain(1..3)), vec![2, 3]);
assert_eq!(Vec::from_iter(tv.clone().drain(0..=1)), vec![1, 2]);
assert_eq!(Vec::from_iter(tv.clone().drain(0..=2)), vec![1, 2, 3]);
assert_eq!(Vec::from_iter(tv.clone().drain(1..=1)), vec![2]);
assert_eq!(Vec::from_iter(tv.clone().drain(1..=2)), vec![2, 3]);
}
#[test]
fn TinyVec_splice() {
let mut tv: TinyVec<[i32; 10]> = Default::default();
tv.push(1);
tv.push(2);
tv.push(3);
// splice returns the same things as drain
assert_eq!(Vec::from_iter(tv.clone().splice(.., None)), vec![1, 2, 3]);
assert_eq!(Vec::from_iter(tv.clone().splice(..2, None)), vec![1, 2]);
assert_eq!(Vec::from_iter(tv.clone().splice(..3, None)), vec![1, 2, 3]);
assert_eq!(Vec::from_iter(tv.clone().splice(..=1, None)), vec![1, 2]);
assert_eq!(Vec::from_iter(tv.clone().splice(..=2, None)), vec![1, 2, 3]);
assert_eq!(Vec::from_iter(tv.clone().splice(0.., None)), vec![1, 2, 3]);
assert_eq!(Vec::from_iter(tv.clone().splice(1.., None)), vec![2, 3]);
assert_eq!(Vec::from_iter(tv.clone().splice(0..2, None)), vec![1, 2]);
assert_eq!(Vec::from_iter(tv.clone().splice(0..3, None)), vec![1, 2, 3]);
assert_eq!(Vec::from_iter(tv.clone().splice(1..2, None)), vec![2]);
assert_eq!(Vec::from_iter(tv.clone().splice(1..3, None)), vec![2, 3]);
assert_eq!(Vec::from_iter(tv.clone().splice(0..=1, None)), vec![1, 2]);
assert_eq!(Vec::from_iter(tv.clone().splice(0..=2, None)), vec![1, 2, 3]);
assert_eq!(Vec::from_iter(tv.clone().splice(1..=1, None)), vec![2]);
assert_eq!(Vec::from_iter(tv.clone().splice(1..=2, None)), vec![2, 3]);
// splice removes the same things as drain
let mut tv2 = tv.clone();
tv2.splice(.., None);
assert_eq!(tv2, tiny_vec![]);
let mut tv2 = tv.clone();
tv2.splice(..2, None);
assert_eq!(tv2, tiny_vec![3]);
let mut tv2 = tv.clone();
tv2.splice(..3, None);
assert_eq!(tv2, tiny_vec![]);
let mut tv2 = tv.clone();
tv2.splice(..=1, None);
assert_eq!(tv2, tiny_vec![3]);
let mut tv2 = tv.clone();
tv2.splice(..=2, None);
assert_eq!(tv2, tiny_vec![]);
let mut tv2 = tv.clone();
tv2.splice(0.., None);
assert_eq!(tv2, tiny_vec![]);
let mut tv2 = tv.clone();
tv2.splice(1.., None);
assert_eq!(tv2, tiny_vec![1]);
let mut tv2 = tv.clone();
tv2.splice(0..2, None);
assert_eq!(tv2, tiny_vec![3]);
let mut tv2 = tv.clone();
tv2.splice(0..3, None);
assert_eq!(tv2, tiny_vec![]);
let mut tv2 = tv.clone();
tv2.splice(1..2, None);
assert_eq!(tv2, tiny_vec![1, 3]);
let mut tv2 = tv.clone();
tv2.splice(1..3, None);
assert_eq!(tv2, tiny_vec![1]);
let mut tv2 = tv.clone();
tv2.splice(0..=1, None);
assert_eq!(tv2, tiny_vec![3]);
let mut tv2 = tv.clone();
tv2.splice(0..=2, None);
assert_eq!(tv2, tiny_vec![]);
let mut tv2 = tv.clone();
tv2.splice(1..=1, None);
assert_eq!(tv2, tiny_vec![1, 3]);
let mut tv2 = tv.clone();
tv2.splice(1..=2, None);
assert_eq!(tv2, tiny_vec![1]);
// splice adds the elements correctly
let mut tv2 = tv.clone();
tv2.splice(.., 4..=6);
assert_eq!(tv2, tiny_vec![4, 5, 6]);
let mut tv2 = tv.clone();
tv2.splice(..2, 4..=6);
assert_eq!(tv2, tiny_vec![4, 5, 6, 3]);
let mut tv2 = tv.clone();
tv2.splice(..3, 4..=6);
assert_eq!(tv2, tiny_vec![4, 5, 6]);
let mut tv2 = tv.clone();
tv2.splice(..=1, 4..=6);
assert_eq!(tv2, tiny_vec![4, 5, 6, 3]);
let mut tv2 = tv.clone();
tv2.splice(..=2, 4..=6);
assert_eq!(tv2, tiny_vec![4, 5, 6]);
let mut tv2 = tv.clone();
tv2.splice(0.., 4..=6);
assert_eq!(tv2, tiny_vec![4, 5, 6]);
let mut tv2 = tv.clone();
tv2.splice(1.., 4..=6);
assert_eq!(tv2, tiny_vec![1, 4, 5, 6]);
let mut tv2 = tv.clone();
tv2.splice(0..2, 4..=6);
assert_eq!(tv2, tiny_vec![4, 5, 6, 3]);
let mut tv2 = tv.clone();
tv2.splice(0..3, 4..=6);
assert_eq!(tv2, tiny_vec![4, 5, 6]);
let mut tv2 = tv.clone();
tv2.splice(1..2, 4..=6);
assert_eq!(tv2, tiny_vec![1, 4, 5, 6, 3]);
let mut tv2 = tv.clone();
tv2.splice(1..3, 4..=6);
assert_eq!(tv2, tiny_vec![1, 4, 5, 6]);
let mut tv2 = tv.clone();
tv2.splice(0..=1, 4..=6);
assert_eq!(tv2, tiny_vec![4, 5, 6, 3]);
let mut tv2 = tv.clone();
tv2.splice(0..=2, 4..=6);
assert_eq!(tv2, tiny_vec![4, 5, 6]);
let mut tv2 = tv.clone();
tv2.splice(1..=1, 4..=6);
assert_eq!(tv2, tiny_vec![1, 4, 5, 6, 3]);
let mut tv2 = tv.clone();
tv2.splice(1..=2, 4..=6);
assert_eq!(tv2, tiny_vec![1, 4, 5, 6]);
// splice adds the elements correctly when the replacement is smaller
let mut tv2 = tv.clone();
tv2.splice(.., Some(4));
assert_eq!(tv2, tiny_vec![4]);
let mut tv2 = tv.clone();
tv2.splice(..2, Some(4));
assert_eq!(tv2, tiny_vec![4, 3]);
let mut tv2 = tv.clone();
tv2.splice(1.., Some(4));
assert_eq!(tv2, tiny_vec![1, 4]);
let mut tv2 = tv.clone();
tv2.splice(1..=1, Some(4));
assert_eq!(tv2, tiny_vec![1, 4, 3]);
}
#[test]
fn TinyVec_resize() {
let mut tv: TinyVec<[i32; 10]> = Default::default();
tv.resize(20, 5);
assert_eq!(&tv[..], &[5; 20]);
}
#[test]
fn TinyVec_from_slice_impl() {
let bigger_slice: [u8; 11] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
let tinyvec: TinyVec<[u8; 10]> = TinyVec::Heap((&bigger_slice[..]).into());
assert_eq!(TinyVec::from(&bigger_slice[..]), tinyvec);
let smaller_slice: [u8; 5] = [0, 1, 2, 3, 4];
let tinyvec: TinyVec<[u8; 10]> = TinyVec::Inline(ArrayVec::from_array_len(
[0, 1, 2, 3, 4, 0, 0, 0, 0, 0],
5,
));
assert_eq!(TinyVec::from(&smaller_slice[..]), tinyvec);
let same_size: [u8; 4] = [0, 1, 2, 3];
let tinyvec: TinyVec<[u8; 4]> =
TinyVec::Inline(ArrayVec::from_array_len(same_size, 4));
assert_eq!(TinyVec::from(&same_size[..]), tinyvec);
}
#[test]
fn TinyVec_from_array() {
let array = [9, 8, 7, 6, 5, 4, 3, 2, 1];
let tv = TinyVec::from(array);
assert_eq!(&array, &tv[..]);
}
#[test]
fn TinyVec_macro() {
let mut expected: TinyVec<[i32; 4]> = Default::default();
expected.push(1);
expected.push(2);
expected.push(3);
let actual = tiny_vec!(1, 2, 3);
assert_eq!(expected, actual);
assert_eq!(tiny_vec![0u8; 4], tiny_vec!(0u8, 0u8, 0u8, 0u8));
assert_eq!(tiny_vec![0u8; 4], tiny_vec!([u8; 4] => 0, 0, 0, 0));
assert_eq!(tiny_vec![0; 4], tiny_vec!(0, 0, 0, 0));
assert_eq!(tiny_vec![0; 4], tiny_vec!([u8; 4] => 0, 0, 0, 0));
let expected2 = tiny_vec![1.1; 3];
let actual2 = tiny_vec!([f32; 3] => 1.1, 1.1, 1.1);
assert_eq!(expected2, actual2);
}
#[test]
fn TinyVec_macro_non_copy() {
// must use a variable here to avoid macro shenanigans
let s = String::new();
let _: TinyVec<[String; 10]> = tiny_vec!([String; 10] => s);
}
#[test]
fn TinyVec_reserve() {
let mut tv: TinyVec<[i32; 4]> = Default::default();
assert_eq!(tv.capacity(), 4);
tv.extend_from_slice(&[1, 2]);
assert_eq!(tv.capacity(), 4);
tv.reserve(2);
assert_eq!(tv.capacity(), 4);
tv.reserve(4);
assert!(tv.capacity() >= 6);
tv.extend_from_slice(&[3, 4, 5, 6]);
tv.reserve(4);
assert!(tv.capacity() >= 10);
}
#[cfg(feature = "rustc_1_57")]
#[test]
fn TinyVec_try_reserve() {
let mut tv: TinyVec<[i32; 4]> = Default::default();
assert_eq!(tv.capacity(), 4);
tv.extend_from_slice(&[1, 2]);
assert_eq!(tv.capacity(), 4);
assert!(tv.try_reserve(2).is_ok());
assert_eq!(tv.capacity(), 4);
assert!(tv.try_reserve(4).is_ok());
assert!(tv.capacity() >= 6);
tv.extend_from_slice(&[3, 4, 5, 6]);
assert!(tv.try_reserve(4).is_ok());
assert!(tv.capacity() >= 10);
}
#[test]
fn TinyVec_reserve_exact() {
let mut tv: TinyVec<[i32; 4]> = Default::default();
assert_eq!(tv.capacity(), 4);
tv.extend_from_slice(&[1, 2]);
assert_eq!(tv.capacity(), 4);
tv.reserve_exact(2);
assert_eq!(tv.capacity(), 4);
tv.reserve_exact(4);
assert!(tv.capacity() >= 6);
tv.extend_from_slice(&[3, 4, 5, 6]);
tv.reserve_exact(4);
assert!(tv.capacity() >= 10);
}
#[cfg(feature = "rustc_1_57")]
#[test]
fn TinyVec_try_reserve_exact() {
let mut tv: TinyVec<[i32; 4]> = Default::default();
assert_eq!(tv.capacity(), 4);
tv.extend_from_slice(&[1, 2]);
assert_eq!(tv.capacity(), 4);
assert!(tv.try_reserve_exact(2).is_ok());
assert_eq!(tv.capacity(), 4);
assert!(tv.try_reserve_exact(4).is_ok());
assert!(tv.capacity() >= 6);
tv.extend_from_slice(&[3, 4, 5, 6]);
assert!(tv.try_reserve_exact(4).is_ok());
assert!(tv.capacity() >= 10);
}
#[test]
fn TinyVec_move_to_heap_and_shrink() {
let mut tv: TinyVec<[i32; 4]> = Default::default();
assert!(tv.is_inline());
tv.move_to_the_heap();
assert!(tv.is_heap());
assert_eq!(tv.capacity(), 0);
tv.push(1);
tv.shrink_to_fit();
assert!(tv.is_inline());
assert_eq!(tv.capacity(), 4);
tv.move_to_the_heap_and_reserve(3);
assert!(tv.is_heap());
assert_eq!(tv.capacity(), 4);
tv.extend(2..=4);
assert_eq!(tv.capacity(), 4);
assert_eq!(tv.as_slice(), [1, 2, 3, 4]);
}
#[cfg(feature = "rustc_1_57")]
#[test]
fn TinyVec_try_move_to_heap_and_shrink() {
let mut tv: TinyVec<[i32; 4]> = Default::default();
assert!(tv.is_inline());
assert!(tv.try_move_to_the_heap().is_ok());
assert!(tv.is_heap());
assert_eq!(tv.capacity(), 0);
assert!(tv.try_reserve_exact(1).is_ok());
assert_eq!(tv.capacity(), 1);
tv.push(1);
tv.shrink_to_fit();
assert!(tv.is_inline());
assert_eq!(tv.capacity(), 4);
assert!(tv.try_move_to_the_heap_and_reserve(3).is_ok());
assert!(tv.is_heap());
assert_eq!(tv.capacity(), 4);
tv.extend(2..=4);
assert_eq!(tv.capacity(), 4);
assert_eq!(tv.as_slice(), [1, 2, 3, 4]);
}
#[cfg(feature = "serde")]
#[test]
fn TinyVec_ser_de_empty() {
let tv: TinyVec<[i32; 0]> = tiny_vec![];
assert_tokens(&tv, &[Token::Seq { len: Some(0) }, Token::SeqEnd]);
}
#[cfg(feature = "serde")]
#[test]
fn TinyVec_ser_de() {
let tv: TinyVec<[i32; 4]> = tiny_vec![1, 2, 3, 4];
assert_tokens(
&tv,
&[
Token::Seq { len: Some(4) },
Token::I32(1),
Token::I32(2),
Token::I32(3),
Token::I32(4),
Token::SeqEnd,
],
);
}
#[cfg(feature = "serde")]
#[test]
fn TinyVec_ser_de_heap() {
let mut tv: TinyVec<[i32; 4]> = tiny_vec![1, 2, 3, 4];
tv.move_to_the_heap();
assert_tokens(
&tv,
&[
Token::Seq { len: Some(4) },
Token::I32(1),
Token::I32(2),
Token::I32(3),
Token::I32(4),
Token::SeqEnd,
],
);
}
#[cfg(feature = "borsh")]
#[test]
fn TinyVec_borsh_de_empty() {
let tv: ArrayVec<[i32; 0]> = Default::default();
let buffer = borsh::to_vec(&tv).unwrap();
let des: ArrayVec<[i32; 0]> = borsh::from_slice(&buffer).unwrap();
assert_eq!(tv, des);
}
#[cfg(feature = "borsh")]
#[test]
fn TinyVec_borsh_de() {
let mut tv: ArrayVec<[i32; 4]> = Default::default();
tv.push(1);
tv.push(2);
tv.push(3);
tv.push(4);
let buffer = borsh::to_vec(&tv).unwrap();
let des: ArrayVec<[i32; 4]> = borsh::from_slice(&buffer).unwrap();
assert_eq!(tv, des);
}
#[cfg(feature = "borsh")]
#[test]
fn TinyVec_borsh_de_heap() {
let mut tv: TinyVec<[i32; 4]> = tiny_vec![1, 2, 3, 4];
tv.move_to_the_heap();
let buffer = borsh::to_vec(&tv).unwrap();
let des: TinyVec<[i32; 4]> = borsh::from_slice(&buffer).unwrap();
assert_eq!(tv, des);
}
#[test]
fn TinyVec_pretty_debug() {
let tv: TinyVec<[i32; 6]> = tiny_vec![1, 2, 3];
let s = format!("{:#?}", tv);
let expected = format!("{:#?}", tv.as_slice());
assert_eq!(s, expected);
}
#[cfg(feature = "std")]
#[test]
fn TinyVec_std_io_write() {
use std::io::Write;
let mut tv: TinyVec<[u8; 3]> = TinyVec::new();
tv.write_all(b"foo").ok();
assert!(tv.is_inline());
assert_eq!(tv, tiny_vec![b'f', b'o', b'o']);
tv.write_all(b"bar").ok();
assert!(tv.is_heap());
assert_eq!(tv, tiny_vec![b'f', b'o', b'o', b'b', b'a', b'r']);
}