summaryrefslogtreecommitdiffstats
path: root/vendor/tinyvec
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
commit698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch)
tree173a775858bd501c378080a10dca74132f05bc50 /vendor/tinyvec
parentInitial commit. (diff)
downloadrustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz
rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/tinyvec')
-rw-r--r--vendor/tinyvec/.cargo-checksum.json1
-rw-r--r--vendor/tinyvec/CHANGELOG.md73
-rw-r--r--vendor/tinyvec/Cargo.toml113
-rw-r--r--vendor/tinyvec/LICENSE-APACHE.md202
-rw-r--r--vendor/tinyvec/LICENSE-MIT.md5
-rw-r--r--vendor/tinyvec/LICENSE-ZLIB.md11
-rw-r--r--vendor/tinyvec/README.md19
-rw-r--r--vendor/tinyvec/benches/macros.rs52
-rw-r--r--vendor/tinyvec/benches/smallvec.rs500
-rw-r--r--vendor/tinyvec/compare_benchmarks.py30
-rw-r--r--vendor/tinyvec/gen-array-impls.sh53
-rw-r--r--vendor/tinyvec/rustfmt.toml14
-rw-r--r--vendor/tinyvec/src-backup/arrayset.rs303
-rw-r--r--vendor/tinyvec/src/array.rs48
-rw-r--r--vendor/tinyvec/src/array/const_generic_impl.rs23
-rw-r--r--vendor/tinyvec/src/array/generated_impl.rs9616
-rw-r--r--vendor/tinyvec/src/arrayvec.rs1873
-rw-r--r--vendor/tinyvec/src/arrayvec_drain.rs93
-rw-r--r--vendor/tinyvec/src/lib.rs107
-rw-r--r--vendor/tinyvec/src/slicevec.rs1080
-rw-r--r--vendor/tinyvec/src/tinyvec.rs1740
-rw-r--r--vendor/tinyvec/tests/arrayvec.rs477
-rw-r--r--vendor/tinyvec/tests/tinyvec.rs468
23 files changed, 16901 insertions, 0 deletions
diff --git a/vendor/tinyvec/.cargo-checksum.json b/vendor/tinyvec/.cargo-checksum.json
new file mode 100644
index 000000000..8320a0ff6
--- /dev/null
+++ b/vendor/tinyvec/.cargo-checksum.json
@@ -0,0 +1 @@
+{"files":{"CHANGELOG.md":"ba1670e87d405d529ed865529527f8ed4745dc9e546b2261a977f39f5e22fc0a","Cargo.toml":"1d9f89358780ead10a883bea408af7271561f074bedb8e5755c3136182c170f4","LICENSE-APACHE.md":"3ddf9be5c28fe27dad143a5dc76eea25222ad1dd68934a047064e56ed2fa40c5","LICENSE-MIT.md":"4736b5d379253afa45744afc79ddb475912b213e939bdf7cb97d9a8b6f700e5f","LICENSE-ZLIB.md":"682b4c81b85e83ce6cc6e1ace38fdd97aeb4de0e972bd2b44aa0916c54af8c96","README.md":"f2a59c75ef204e21173b2be150d183a946d0f10ad3a42d3e677d6f5507589aa4","benches/macros.rs":"b92679a63e1d39fd949c061fa97dfba933f3e1a6e6722e710cfe4fbfd6315ba9","benches/smallvec.rs":"977761721e1b419966441a767f9eed23b82e6f805e0d496b9905d225600fc050","compare_benchmarks.py":"899f3d88c95f0f02563f869fd683a9c95afb1a8c773edf2d0a8d3355f1ceb07c","gen-array-impls.sh":"6bb75d48b820112b7d0a67e09fb3c2386b2961de42f482635007435956f74b12","rustfmt.toml":"ebb19c2c422dcc6c0fe960e5a869b5a562739e40f248e28c43d48d9a63cebe7b","src-backup/arrayset.rs":"d7d524c9c0a20443f6f028ff0e37d246cd445a0660df496625d647ea302a5094","src/array.rs":"ae2bc64b339ff3e8a17684b25a180fbf04184cae26baf05fb8ed542005f6d9f5","src/array/const_generic_impl.rs":"d0f8ae529b5c9f92da0aa67d5ae24a6e7fc3287ce6d3e576794455de44502a4c","src/array/generated_impl.rs":"8c94c274aae0909b7de75beff4215af8dfc8635cce0c09d75eb57e577c3cca68","src/arrayvec.rs":"349395049164b38f6d8ad9fda8ed925855955cf348b087c796fb9113c1d25687","src/arrayvec_drain.rs":"d2df895c7438bbf3bcf2f68ab5e76ca2209f399ef8dde5d62532c9e176c620b5","src/lib.rs":"867817c74c52316ffdea3a7a7cdf8285cadebe63cf63fb966aafd8130f796db4","src/slicevec.rs":"e43991aff8197095fda62a1e6d3657fcb08e27e386e67f0496ac8228a56bd271","src/tinyvec.rs":"a58c5b8e52619476da195c060a867d99ee0881bdd9e8eeabad947ee949b858af","tests/arrayvec.rs":"e7c22cbcf8df2c0a5ae20a35c1a1327e86230db0ee6fbc25d3ff5000b0044ccc","tests/tinyvec.rs":"8f61a29426ac573999e6328a1bd74d7bc19884b3e38dcfda0a254dc91c1d2310"},"package":"87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50"} \ No newline at end of file
diff --git a/vendor/tinyvec/CHANGELOG.md b/vendor/tinyvec/CHANGELOG.md
new file mode 100644
index 000000000..6f7d2c05e
--- /dev/null
+++ b/vendor/tinyvec/CHANGELOG.md
@@ -0,0 +1,73 @@
+# Changelog
+
+## 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.
diff --git a/vendor/tinyvec/Cargo.toml b/vendor/tinyvec/Cargo.toml
new file mode 100644
index 000000000..6c9c35e19
--- /dev/null
+++ b/vendor/tinyvec/Cargo.toml
@@ -0,0 +1,113 @@
+# 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.6.0"
+authors = ["Lokathor <zefria@gmail.com>"]
+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",
+ "rustc_1_40",
+ "rustc_1_55",
+ "serde",
+]
+rustdoc-args = [
+ "--cfg",
+ "docs_rs",
+]
+
+[package.metadata.playground]
+features = [
+ "alloc",
+ "std",
+ "grab_spare_slice",
+ "rustc_1_40",
+ "rustc_1_55",
+ "serde",
+]
+
+[profile.bench]
+debug = 2
+
+[profile.test]
+opt-level = 3
+
+[[test]]
+name = "tinyvec"
+required-features = [
+ "alloc",
+ "std",
+]
+
+[[bench]]
+name = "macros"
+harness = false
+required-features = ["alloc"]
+
+[[bench]]
+name = "smallvec"
+harness = false
+required-features = [
+ "alloc",
+ "real_blackbox",
+]
+
+[dependencies.arbitrary]
+version = "1"
+optional = true
+
+[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.serde_test]
+version = "1.0"
+
+[dev-dependencies.smallvec]
+version = "1"
+
+[features]
+alloc = ["tinyvec_macros"]
+default = []
+experimental_write_impl = []
+grab_spare_slice = []
+nightly_slice_partition_dedup = []
+real_blackbox = ["criterion/real_blackbox"]
+rustc_1_40 = []
+rustc_1_55 = ["rustc_1_40"]
+rustc_1_57 = ["rustc_1_55"]
+std = ["alloc"]
diff --git a/vendor/tinyvec/LICENSE-APACHE.md b/vendor/tinyvec/LICENSE-APACHE.md
new file mode 100644
index 000000000..75b52484e
--- /dev/null
+++ b/vendor/tinyvec/LICENSE-APACHE.md
@@ -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.
diff --git a/vendor/tinyvec/LICENSE-MIT.md b/vendor/tinyvec/LICENSE-MIT.md
new file mode 100644
index 000000000..62d1fe61f
--- /dev/null
+++ b/vendor/tinyvec/LICENSE-MIT.md
@@ -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.
diff --git a/vendor/tinyvec/LICENSE-ZLIB.md b/vendor/tinyvec/LICENSE-ZLIB.md
new file mode 100644
index 000000000..aa2dabe63
--- /dev/null
+++ b/vendor/tinyvec/LICENSE-ZLIB.md
@@ -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.
diff --git a/vendor/tinyvec/README.md b/vendor/tinyvec/README.md
new file mode 100644
index 000000000..87973bbea
--- /dev/null
+++ b/vendor/tinyvec/README.md
@@ -0,0 +1,19 @@
+[![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.34-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. `#![forbid(unsafe_code)]`
+
+Main types are as follows:
+* `ArrayVec` is an array-backed vec-like data structure. It panics on overflow.
+* `SliceVec` is the same deal, but using a `&mut [T]`.
+* `TinyVec` (`alloc` feature) is an enum that's either an `Inline(ArrayVec)` or a `Heap(Vec)`. If a `TinyVec` is `Inline` and would overflow 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 details, please see [the docs.rs documentation](https://docs.rs/tinyvec/)
diff --git a/vendor/tinyvec/benches/macros.rs b/vendor/tinyvec/benches/macros.rs
new file mode 100644
index 000000000..16be57b7c
--- /dev/null
+++ b/vendor/tinyvec/benches/macros.rs
@@ -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);
diff --git a/vendor/tinyvec/benches/smallvec.rs b/vendor/tinyvec/benches/smallvec.rs
new file mode 100644
index 000000000..8cd16d3ec
--- /dev/null
+++ b/vendor/tinyvec/benches/smallvec.rs
@@ -0,0 +1,500 @@
+//! 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);
diff --git a/vendor/tinyvec/compare_benchmarks.py b/vendor/tinyvec/compare_benchmarks.py
new file mode 100644
index 000000000..86eb7e862
--- /dev/null
+++ b/vendor/tinyvec/compare_benchmarks.py
@@ -0,0 +1,30 @@
+import os
+import os.path
+import json
+
+comparisons = []
+
+for (root, _dirs, files) in os.walk('target/criterion'):
+ for file in files:
+ if file == 'estimates.json' and root.endswith(
+ 'new') and 'TinyVec' in root:
+ path = os.path.join(root, file)
+
+ bench_name = path.split('/')[3]
+ tinyvec_time = json.load(open(path))['mean']['point_estimate']
+
+ path = path.replace('TinyVec', 'SmallVec')
+
+ smallvec_time = json.load(open(path))['mean']['point_estimate']
+
+ comparisons.append((bench_name, tinyvec_time / smallvec_time))
+
+comparisons.sort(key=lambda x: x[1])
+longest_name = max(len(c[0]) for c in comparisons)
+for (name, ratio) in comparisons:
+ # Undo the criterion name mangling
+ name = name.replace('_[', '<[')
+ name = name.replace(']___', ']>::')
+
+ name = name.ljust(longest_name)
+ print(f"{name} {ratio:.2f}")
diff --git a/vendor/tinyvec/gen-array-impls.sh b/vendor/tinyvec/gen-array-impls.sh
new file mode 100644
index 000000000..234f771bc
--- /dev/null
+++ b/vendor/tinyvec/gen-array-impls.sh
@@ -0,0 +1,53 @@
+#!/usr/bin/env bash
+
+gen_impl() {
+ local len=$1
+ cat <<-END
+ impl<T: Default> Array for [T; $len] {
+ type Item = T;
+ const CAPACITY: usize = $len;
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice(&self) -> &[T] {
+ &*self
+ }
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice_mut(&mut self) -> &mut [T] {
+ &mut *self
+ }
+
+ #[inline(always)]
+ fn default() -> Self {
+ [
+ $(for ((i = 0; i < $len; i += 6))
+ do
+ echo -n ' '
+ for ((j = 0; j < 6 && j + i < $len; j++))
+ do
+ echo -n ' T::default(),'
+ done
+ echo
+ done)
+ ]
+ }
+ }
+
+ END
+}
+
+cat <<-END
+ // Generated file, to regenerate run
+ // ./gen-array-impls.sh > src/array/generated_impl.rs
+ // from the repo root
+
+ use super::Array;
+
+ $(for ((i = 0; i <= 33; i++)); do gen_impl $i; done)
+
+ $(for ((i = 64; i <= 4096; i *= 2)); do gen_impl $i; done)
+END
+
+# vim: noet
diff --git a/vendor/tinyvec/rustfmt.toml b/vendor/tinyvec/rustfmt.toml
new file mode 100644
index 000000000..59b3aaefd
--- /dev/null
+++ b/vendor/tinyvec/rustfmt.toml
@@ -0,0 +1,14 @@
+
+# Stable
+edition = "2018"
+fn_args_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"
diff --git a/vendor/tinyvec/src-backup/arrayset.rs b/vendor/tinyvec/src-backup/arrayset.rs
new file mode 100644
index 000000000..22ea7cae9
--- /dev/null
+++ b/vendor/tinyvec/src-backup/arrayset.rs
@@ -0,0 +1,303 @@
+#![cfg(feature = "experimental_array_set")]
+
+// This was contributed by user `dhardy`! Big thanks.
+
+use super::{take, Array};
+use core::{
+ borrow::Borrow,
+ fmt,
+ mem::swap,
+ ops::{AddAssign, SubAssign},
+};
+
+/// Error resulting from attempting to insert into a full array
+#[derive(Copy, Clone, Debug, PartialEq, Eq)]
+pub struct InsertError;
+
+// TODO(when std): impl std::error::Error for InsertError {}
+
+impl fmt::Display for InsertError {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ write!(f, "ArraySet: insertion failed")
+ }
+}
+
+/// An array-backed set
+///
+/// This set supports `O(n)` operations and has a fixed size, thus may fail to
+/// insert items. The potential advantage is a *really* small size.
+///
+/// The set is backed by an array of type `A` and indexed by type `L`.
+/// The item type must support `Default`.
+/// Due to restrictions, `L` may be only `u8` or `u16`.
+#[derive(Clone, Debug, Default)]
+pub struct ArraySet<A: Array, L> {
+ arr: A,
+ len: L,
+}
+
+impl<A: Array + Default, L: From<u8>> ArraySet<A, L> {
+ /// Constructs a new, empty, set
+ #[inline]
+ pub fn new() -> Self {
+ ArraySet { arr: Default::default(), len: 0.into() }
+ }
+}
+
+impl<A: Array, L: Copy + Into<usize>> ArraySet<A, L> {
+ /// Constructs a new set from given inputs
+ ///
+ /// Panics if `len> arr.len()`.
+ #[inline]
+ pub fn from(arr: A, len: L) -> Self {
+ if len.into() > A::CAPACITY {
+ panic!("ArraySet::from(array, len): len > array.len()");
+ }
+ ArraySet { arr, len }
+ }
+}
+
+impl<A: Array, L> ArraySet<A, L>
+where
+ L: Copy + PartialEq + From<u8> + Into<usize>,
+{
+ /// Returns the fixed capacity of the set
+ #[inline]
+ pub fn capacity(&self) -> usize {
+ A::CAPACITY
+ }
+
+ /// Returns the number of elements in the set
+ #[inline]
+ pub fn len(&self) -> usize {
+ self.len.into()
+ }
+
+ /// Returns true when the set contains no elements
+ #[inline]
+ pub fn is_empty(&self) -> bool {
+ self.len == 0.into()
+ }
+
+ /// Removes all elements
+ #[inline]
+ pub fn clear(&mut self) {
+ self.len = 0.into();
+ }
+
+ /// Iterate over all contents
+ #[inline]
+ pub fn iter(&self) -> Iter<A::Item> {
+ Iter { a: self.arr.as_slice(), i: 0 }
+ }
+}
+
+impl<A: Array, L> ArraySet<A, L>
+where
+ L: Copy + PartialOrd + AddAssign + SubAssign + From<u8> + Into<usize>,
+{
+ /// Check whether the set contains `elt`
+ #[inline]
+ pub fn contains<Q: Eq + ?Sized>(&self, elt: &Q) -> bool
+ where
+ A::Item: Borrow<Q>,
+ {
+ self.get(elt).is_some()
+ }
+
+ /// Get a reference to a contained item matching `elt`
+ pub fn get<Q: Eq + ?Sized>(&self, elt: &Q) -> Option<&A::Item>
+ where
+ A::Item: Borrow<Q>,
+ {
+ let len: usize = self.len.into();
+ let arr = self.arr.as_slice();
+ for i in 0..len {
+ if arr[i].borrow() == elt {
+ return Some(&arr[i]);
+ }
+ }
+ None
+ }
+
+ /// Remove an item matching `elt`, if any
+ pub fn remove<Q: Eq + ?Sized>(&mut self, elt: &Q) -> Option<A::Item>
+ where
+ A::Item: Borrow<Q>,
+ {
+ let len: usize = self.len.into();
+ let arr = self.arr.as_slice_mut();
+ for i in 0..len {
+ if arr[i].borrow() == elt {
+ let l1 = len - 1;
+ if i < l1 {
+ arr.swap(i, l1);
+ }
+ self.len -= L::from(1);
+ return Some(take(&mut arr[l1]));
+ }
+ }
+ None
+ }
+
+ /// Remove any items for which `f(item) == false`
+ pub fn retain<F>(&mut self, mut f: F)
+ where
+ F: FnMut(&A::Item) -> bool,
+ {
+ let mut len = self.len;
+ let arr = self.arr.as_slice_mut();
+ let mut i = 0;
+ while i < len.into() {
+ if !f(&arr[i]) {
+ len -= L::from(1);
+ if i < len.into() {
+ arr.swap(i, len.into());
+ }
+ } else {
+ i += 1;
+ }
+ }
+ self.len = len;
+ }
+}
+
+impl<A: Array, L> ArraySet<A, L>
+where
+ A::Item: Eq,
+ L: Copy + PartialOrd + AddAssign + SubAssign + From<u8> + Into<usize>,
+{
+ /// Insert an item
+ ///
+ /// Due to the fixed size of the backing array, insertion may fail.
+ #[inline]
+ pub fn insert(&mut self, elt: A::Item) -> Result<bool, InsertError> {
+ if self.contains(&elt) {
+ return Ok(false);
+ }
+
+ let len = self.len.into();
+ let arr = self.arr.as_slice_mut();
+ if len >= arr.len() {
+ return Err(InsertError);
+ }
+ arr[len] = elt;
+ self.len += L::from(1);
+ Ok(true)
+ }
+
+ /* Hits borrow checker
+ pub fn get_or_insert(&mut self, elt: A::Item) -> Result<&A::Item, InsertError> {
+ if let Some(r) = self.get(&elt) {
+ return Ok(r);
+ }
+ self.insert(elt)?;
+ let len: usize = self.len.into();
+ Ok(&self.arr.as_slice()[len - 1])
+ }
+ */
+
+ /// Replace an item matching `elt` with `elt`, or insert `elt`
+ ///
+ /// Returns the replaced item, if any. Fails when there is no matching item
+ /// and the backing array is full, preventing insertion.
+ pub fn replace(
+ &mut self,
+ mut elt: A::Item,
+ ) -> Result<Option<A::Item>, InsertError> {
+ let len: usize = self.len.into();
+ let arr = self.arr.as_slice_mut();
+ for i in 0..len {
+ if arr[i] == elt {
+ swap(&mut arr[i], &mut elt);
+ return Ok(Some(elt));
+ }
+ }
+
+ if len >= arr.len() {
+ return Err(InsertError);
+ }
+ arr[len] = elt;
+ self.len += L::from(1);
+ Ok(None)
+ }
+}
+
+/// Type returned by [`ArraySet::iter`]
+pub struct Iter<'a, T> {
+ a: &'a [T],
+ i: usize,
+}
+
+impl<'a, T> ExactSizeIterator for Iter<'a, T> {
+ #[inline]
+ fn len(&self) -> usize {
+ self.a.len() - self.i
+ }
+}
+
+impl<'a, T> Iterator for Iter<'a, T> {
+ type Item = &'a T;
+
+ #[inline]
+ fn next(&mut self) -> Option<Self::Item> {
+ if self.i < self.a.len() {
+ let i = self.i;
+ self.i += 1;
+ Some(&self.a[i])
+ } else {
+ None
+ }
+ }
+
+ #[inline]
+ fn size_hint(&self) -> (usize, Option<usize>) {
+ let len = self.len();
+ (len, Some(len))
+ }
+}
+
+#[cfg(test)]
+mod test {
+ use super::*;
+ use core::mem::size_of;
+
+ #[test]
+ fn test_size() {
+ assert_eq!(size_of::<ArraySet<[i8; 7], u8>>(), 8);
+ }
+
+ #[test]
+ fn test() {
+ let mut set: ArraySet<[i8; 7], u8> = ArraySet::new();
+ assert_eq!(set.capacity(), 7);
+
+ assert_eq!(set.insert(1), Ok(true));
+ assert_eq!(set.insert(5), Ok(true));
+ assert_eq!(set.insert(6), Ok(true));
+ assert_eq!(set.len(), 3);
+
+ assert_eq!(set.insert(5), Ok(false));
+ assert_eq!(set.len(), 3);
+
+ assert_eq!(set.replace(1), Ok(Some(1)));
+ assert_eq!(set.replace(2), Ok(None));
+ assert_eq!(set.len(), 4);
+
+ assert_eq!(set.insert(3), Ok(true));
+ assert_eq!(set.insert(4), Ok(true));
+ assert_eq!(set.insert(7), Ok(true));
+ assert_eq!(set.insert(8), Err(InsertError));
+ assert_eq!(set.len(), 7);
+
+ assert_eq!(set.replace(9), Err(InsertError));
+
+ assert_eq!(set.remove(&3), Some(3));
+ assert_eq!(set.len(), 6);
+
+ set.retain(|x| *x == 3 || *x == 6);
+ assert_eq!(set.len(), 1);
+ assert!(!set.contains(&3));
+ assert!(set.contains(&6));
+ }
+}
diff --git a/vendor/tinyvec/src/array.rs b/vendor/tinyvec/src/array.rs
new file mode 100644
index 000000000..cc84aaf74
--- /dev/null
+++ b/vendor/tinyvec/src/array.rs
@@ -0,0 +1,48 @@
+/// 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 the major array lengths (`0..=32` and the powers
+/// of 2 up to 4,096), or for all array lengths with the feature `rustc_1_55`.
+///
+/// **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;
+}
+
+#[cfg(feature = "rustc_1_55")]
+mod const_generic_impl;
+
+#[cfg(not(feature = "rustc_1_55"))]
+mod generated_impl;
diff --git a/vendor/tinyvec/src/array/const_generic_impl.rs b/vendor/tinyvec/src/array/const_generic_impl.rs
new file mode 100644
index 000000000..0b145f168
--- /dev/null
+++ b/vendor/tinyvec/src/array/const_generic_impl.rs
@@ -0,0 +1,23 @@
+use super::Array;
+
+impl<T: Default, const N: usize> Array for [T; N] {
+ type Item = T;
+ const CAPACITY: usize = N;
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice(&self) -> &[T] {
+ &*self
+ }
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice_mut(&mut self) -> &mut [T] {
+ &mut *self
+ }
+
+ #[inline(always)]
+ fn default() -> Self {
+ [(); N].map(|_| Default::default())
+ }
+}
diff --git a/vendor/tinyvec/src/array/generated_impl.rs b/vendor/tinyvec/src/array/generated_impl.rs
new file mode 100644
index 000000000..d72169c5b
--- /dev/null
+++ b/vendor/tinyvec/src/array/generated_impl.rs
@@ -0,0 +1,9616 @@
+// Generated file, to regenerate run
+// ./gen-array-impls.sh > src/array/generated_impl.rs
+// from the repo root
+
+use super::Array;
+
+impl<T: Default> Array for [T; 0] {
+ type Item = T;
+ const CAPACITY: usize = 0;
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice(&self) -> &[T] {
+ &*self
+ }
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice_mut(&mut self) -> &mut [T] {
+ &mut *self
+ }
+
+ #[inline(always)]
+ fn default() -> Self {
+ []
+ }
+}
+
+impl<T: Default> Array for [T; 1] {
+ type Item = T;
+ const CAPACITY: usize = 1;
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice(&self) -> &[T] {
+ &*self
+ }
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice_mut(&mut self) -> &mut [T] {
+ &mut *self
+ }
+
+ #[inline(always)]
+ fn default() -> Self {
+ [T::default()]
+ }
+}
+
+impl<T: Default> Array for [T; 2] {
+ type Item = T;
+ const CAPACITY: usize = 2;
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice(&self) -> &[T] {
+ &*self
+ }
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice_mut(&mut self) -> &mut [T] {
+ &mut *self
+ }
+
+ #[inline(always)]
+ fn default() -> Self {
+ [T::default(), T::default()]
+ }
+}
+
+impl<T: Default> Array for [T; 3] {
+ type Item = T;
+ const CAPACITY: usize = 3;
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice(&self) -> &[T] {
+ &*self
+ }
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice_mut(&mut self) -> &mut [T] {
+ &mut *self
+ }
+
+ #[inline(always)]
+ fn default() -> Self {
+ [T::default(), T::default(), T::default()]
+ }
+}
+
+impl<T: Default> Array for [T; 4] {
+ type Item = T;
+ const CAPACITY: usize = 4;
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice(&self) -> &[T] {
+ &*self
+ }
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice_mut(&mut self) -> &mut [T] {
+ &mut *self
+ }
+
+ #[inline(always)]
+ fn default() -> Self {
+ [T::default(), T::default(), T::default(), T::default()]
+ }
+}
+
+impl<T: Default> Array for [T; 5] {
+ type Item = T;
+ const CAPACITY: usize = 5;
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice(&self) -> &[T] {
+ &*self
+ }
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice_mut(&mut self) -> &mut [T] {
+ &mut *self
+ }
+
+ #[inline(always)]
+ fn default() -> Self {
+ [T::default(), T::default(), T::default(), T::default(), T::default()]
+ }
+}
+
+impl<T: Default> Array for [T; 6] {
+ type Item = T;
+ const CAPACITY: usize = 6;
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice(&self) -> &[T] {
+ &*self
+ }
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice_mut(&mut self) -> &mut [T] {
+ &mut *self
+ }
+
+ #[inline(always)]
+ fn default() -> Self {
+ [
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ ]
+ }
+}
+
+impl<T: Default> Array for [T; 7] {
+ type Item = T;
+ const CAPACITY: usize = 7;
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice(&self) -> &[T] {
+ &*self
+ }
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice_mut(&mut self) -> &mut [T] {
+ &mut *self
+ }
+
+ #[inline(always)]
+ fn default() -> Self {
+ [
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ ]
+ }
+}
+
+impl<T: Default> Array for [T; 8] {
+ type Item = T;
+ const CAPACITY: usize = 8;
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice(&self) -> &[T] {
+ &*self
+ }
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice_mut(&mut self) -> &mut [T] {
+ &mut *self
+ }
+
+ #[inline(always)]
+ fn default() -> Self {
+ [
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ ]
+ }
+}
+
+impl<T: Default> Array for [T; 9] {
+ type Item = T;
+ const CAPACITY: usize = 9;
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice(&self) -> &[T] {
+ &*self
+ }
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice_mut(&mut self) -> &mut [T] {
+ &mut *self
+ }
+
+ #[inline(always)]
+ fn default() -> Self {
+ [
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ ]
+ }
+}
+
+impl<T: Default> Array for [T; 10] {
+ type Item = T;
+ const CAPACITY: usize = 10;
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice(&self) -> &[T] {
+ &*self
+ }
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice_mut(&mut self) -> &mut [T] {
+ &mut *self
+ }
+
+ #[inline(always)]
+ fn default() -> Self {
+ [
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ ]
+ }
+}
+
+impl<T: Default> Array for [T; 11] {
+ type Item = T;
+ const CAPACITY: usize = 11;
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice(&self) -> &[T] {
+ &*self
+ }
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice_mut(&mut self) -> &mut [T] {
+ &mut *self
+ }
+
+ #[inline(always)]
+ fn default() -> Self {
+ [
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ ]
+ }
+}
+
+impl<T: Default> Array for [T; 12] {
+ type Item = T;
+ const CAPACITY: usize = 12;
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice(&self) -> &[T] {
+ &*self
+ }
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice_mut(&mut self) -> &mut [T] {
+ &mut *self
+ }
+
+ #[inline(always)]
+ fn default() -> Self {
+ [
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ ]
+ }
+}
+
+impl<T: Default> Array for [T; 13] {
+ type Item = T;
+ const CAPACITY: usize = 13;
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice(&self) -> &[T] {
+ &*self
+ }
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice_mut(&mut self) -> &mut [T] {
+ &mut *self
+ }
+
+ #[inline(always)]
+ fn default() -> Self {
+ [
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ ]
+ }
+}
+
+impl<T: Default> Array for [T; 14] {
+ type Item = T;
+ const CAPACITY: usize = 14;
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice(&self) -> &[T] {
+ &*self
+ }
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice_mut(&mut self) -> &mut [T] {
+ &mut *self
+ }
+
+ #[inline(always)]
+ fn default() -> Self {
+ [
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ ]
+ }
+}
+
+impl<T: Default> Array for [T; 15] {
+ type Item = T;
+ const CAPACITY: usize = 15;
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice(&self) -> &[T] {
+ &*self
+ }
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice_mut(&mut self) -> &mut [T] {
+ &mut *self
+ }
+
+ #[inline(always)]
+ fn default() -> Self {
+ [
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ ]
+ }
+}
+
+impl<T: Default> Array for [T; 16] {
+ type Item = T;
+ const CAPACITY: usize = 16;
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice(&self) -> &[T] {
+ &*self
+ }
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice_mut(&mut self) -> &mut [T] {
+ &mut *self
+ }
+
+ #[inline(always)]
+ fn default() -> Self {
+ [
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ ]
+ }
+}
+
+impl<T: Default> Array for [T; 17] {
+ type Item = T;
+ const CAPACITY: usize = 17;
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice(&self) -> &[T] {
+ &*self
+ }
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice_mut(&mut self) -> &mut [T] {
+ &mut *self
+ }
+
+ #[inline(always)]
+ fn default() -> Self {
+ [
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ ]
+ }
+}
+
+impl<T: Default> Array for [T; 18] {
+ type Item = T;
+ const CAPACITY: usize = 18;
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice(&self) -> &[T] {
+ &*self
+ }
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice_mut(&mut self) -> &mut [T] {
+ &mut *self
+ }
+
+ #[inline(always)]
+ fn default() -> Self {
+ [
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ ]
+ }
+}
+
+impl<T: Default> Array for [T; 19] {
+ type Item = T;
+ const CAPACITY: usize = 19;
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice(&self) -> &[T] {
+ &*self
+ }
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice_mut(&mut self) -> &mut [T] {
+ &mut *self
+ }
+
+ #[inline(always)]
+ fn default() -> Self {
+ [
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ ]
+ }
+}
+
+impl<T: Default> Array for [T; 20] {
+ type Item = T;
+ const CAPACITY: usize = 20;
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice(&self) -> &[T] {
+ &*self
+ }
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice_mut(&mut self) -> &mut [T] {
+ &mut *self
+ }
+
+ #[inline(always)]
+ fn default() -> Self {
+ [
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ ]
+ }
+}
+
+impl<T: Default> Array for [T; 21] {
+ type Item = T;
+ const CAPACITY: usize = 21;
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice(&self) -> &[T] {
+ &*self
+ }
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice_mut(&mut self) -> &mut [T] {
+ &mut *self
+ }
+
+ #[inline(always)]
+ fn default() -> Self {
+ [
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ ]
+ }
+}
+
+impl<T: Default> Array for [T; 22] {
+ type Item = T;
+ const CAPACITY: usize = 22;
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice(&self) -> &[T] {
+ &*self
+ }
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice_mut(&mut self) -> &mut [T] {
+ &mut *self
+ }
+
+ #[inline(always)]
+ fn default() -> Self {
+ [
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ ]
+ }
+}
+
+impl<T: Default> Array for [T; 23] {
+ type Item = T;
+ const CAPACITY: usize = 23;
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice(&self) -> &[T] {
+ &*self
+ }
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice_mut(&mut self) -> &mut [T] {
+ &mut *self
+ }
+
+ #[inline(always)]
+ fn default() -> Self {
+ [
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ ]
+ }
+}
+
+impl<T: Default> Array for [T; 24] {
+ type Item = T;
+ const CAPACITY: usize = 24;
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice(&self) -> &[T] {
+ &*self
+ }
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice_mut(&mut self) -> &mut [T] {
+ &mut *self
+ }
+
+ #[inline(always)]
+ fn default() -> Self {
+ [
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ ]
+ }
+}
+
+impl<T: Default> Array for [T; 25] {
+ type Item = T;
+ const CAPACITY: usize = 25;
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice(&self) -> &[T] {
+ &*self
+ }
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice_mut(&mut self) -> &mut [T] {
+ &mut *self
+ }
+
+ #[inline(always)]
+ fn default() -> Self {
+ [
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ ]
+ }
+}
+
+impl<T: Default> Array for [T; 26] {
+ type Item = T;
+ const CAPACITY: usize = 26;
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice(&self) -> &[T] {
+ &*self
+ }
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice_mut(&mut self) -> &mut [T] {
+ &mut *self
+ }
+
+ #[inline(always)]
+ fn default() -> Self {
+ [
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ ]
+ }
+}
+
+impl<T: Default> Array for [T; 27] {
+ type Item = T;
+ const CAPACITY: usize = 27;
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice(&self) -> &[T] {
+ &*self
+ }
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice_mut(&mut self) -> &mut [T] {
+ &mut *self
+ }
+
+ #[inline(always)]
+ fn default() -> Self {
+ [
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ ]
+ }
+}
+
+impl<T: Default> Array for [T; 28] {
+ type Item = T;
+ const CAPACITY: usize = 28;
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice(&self) -> &[T] {
+ &*self
+ }
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice_mut(&mut self) -> &mut [T] {
+ &mut *self
+ }
+
+ #[inline(always)]
+ fn default() -> Self {
+ [
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ ]
+ }
+}
+
+impl<T: Default> Array for [T; 29] {
+ type Item = T;
+ const CAPACITY: usize = 29;
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice(&self) -> &[T] {
+ &*self
+ }
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice_mut(&mut self) -> &mut [T] {
+ &mut *self
+ }
+
+ #[inline(always)]
+ fn default() -> Self {
+ [
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ ]
+ }
+}
+
+impl<T: Default> Array for [T; 30] {
+ type Item = T;
+ const CAPACITY: usize = 30;
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice(&self) -> &[T] {
+ &*self
+ }
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice_mut(&mut self) -> &mut [T] {
+ &mut *self
+ }
+
+ #[inline(always)]
+ fn default() -> Self {
+ [
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ ]
+ }
+}
+
+impl<T: Default> Array for [T; 31] {
+ type Item = T;
+ const CAPACITY: usize = 31;
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice(&self) -> &[T] {
+ &*self
+ }
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice_mut(&mut self) -> &mut [T] {
+ &mut *self
+ }
+
+ #[inline(always)]
+ fn default() -> Self {
+ [
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ ]
+ }
+}
+
+impl<T: Default> Array for [T; 32] {
+ type Item = T;
+ const CAPACITY: usize = 32;
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice(&self) -> &[T] {
+ &*self
+ }
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice_mut(&mut self) -> &mut [T] {
+ &mut *self
+ }
+
+ #[inline(always)]
+ fn default() -> Self {
+ [
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ ]
+ }
+}
+
+impl<T: Default> Array for [T; 33] {
+ type Item = T;
+ const CAPACITY: usize = 33;
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice(&self) -> &[T] {
+ &*self
+ }
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice_mut(&mut self) -> &mut [T] {
+ &mut *self
+ }
+
+ #[inline(always)]
+ fn default() -> Self {
+ [
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ ]
+ }
+}
+
+impl<T: Default> Array for [T; 64] {
+ type Item = T;
+ const CAPACITY: usize = 64;
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice(&self) -> &[T] {
+ &*self
+ }
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice_mut(&mut self) -> &mut [T] {
+ &mut *self
+ }
+
+ #[inline(always)]
+ fn default() -> Self {
+ [
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ ]
+ }
+}
+
+impl<T: Default> Array for [T; 128] {
+ type Item = T;
+ const CAPACITY: usize = 128;
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice(&self) -> &[T] {
+ &*self
+ }
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice_mut(&mut self) -> &mut [T] {
+ &mut *self
+ }
+
+ #[inline(always)]
+ fn default() -> Self {
+ [
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ ]
+ }
+}
+
+impl<T: Default> Array for [T; 256] {
+ type Item = T;
+ const CAPACITY: usize = 256;
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice(&self) -> &[T] {
+ &*self
+ }
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice_mut(&mut self) -> &mut [T] {
+ &mut *self
+ }
+
+ #[inline(always)]
+ fn default() -> Self {
+ [
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ ]
+ }
+}
+
+impl<T: Default> Array for [T; 512] {
+ type Item = T;
+ const CAPACITY: usize = 512;
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice(&self) -> &[T] {
+ &*self
+ }
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice_mut(&mut self) -> &mut [T] {
+ &mut *self
+ }
+
+ #[inline(always)]
+ fn default() -> Self {
+ [
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ ]
+ }
+}
+
+impl<T: Default> Array for [T; 1024] {
+ type Item = T;
+ const CAPACITY: usize = 1024;
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice(&self) -> &[T] {
+ &*self
+ }
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice_mut(&mut self) -> &mut [T] {
+ &mut *self
+ }
+
+ #[inline(always)]
+ fn default() -> Self {
+ [
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ ]
+ }
+}
+
+impl<T: Default> Array for [T; 2048] {
+ type Item = T;
+ const CAPACITY: usize = 2048;
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice(&self) -> &[T] {
+ &*self
+ }
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice_mut(&mut self) -> &mut [T] {
+ &mut *self
+ }
+
+ #[inline(always)]
+ fn default() -> Self {
+ [
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ ]
+ }
+}
+
+impl<T: Default> Array for [T; 4096] {
+ type Item = T;
+ const CAPACITY: usize = 4096;
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice(&self) -> &[T] {
+ &*self
+ }
+
+ #[inline(always)]
+ #[must_use]
+ fn as_slice_mut(&mut self) -> &mut [T] {
+ &mut *self
+ }
+
+ #[inline(always)]
+ fn default() -> Self {
+ [
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ T::default(),
+ ]
+ }
+}
diff --git a/vendor/tinyvec/src/arrayvec.rs b/vendor/tinyvec/src/arrayvec.rs
new file mode 100644
index 000000000..9cfe58d8d
--- /dev/null
+++ b/vendor/tinyvec/src/arrayvec.rs
@@ -0,0 +1,1873 @@
+use super::*;
+use core::convert::{TryFrom, TryInto};
+
+#[cfg(feature = "serde")]
+use core::marker::PhantomData;
+#[cfg(feature = "serde")]
+use serde::de::{
+ Deserialize, Deserializer, Error as DeserializeError, SeqAccess, Visitor,
+};
+#[cfg(feature = "serde")]
+use serde::ser::{Serialize, SerializeSeq, Serializer};
+
+/// Helper to make an `ArrayVec`.
+///
+/// You specify the backing array type, and optionally give all the elements you
+/// want to initially place into the array.
+///
+/// ```rust
+/// use tinyvec::*;
+///
+/// // The backing array type can be specified in the macro call
+/// let empty_av = array_vec!([u8; 16]);
+/// let some_ints = array_vec!([i32; 4] => 1, 2, 3);
+///
+/// // Or left to inference
+/// let empty_av: ArrayVec<[u8; 10]> = array_vec!();
+/// let some_ints: ArrayVec<[u8; 10]> = array_vec!(5, 6, 7, 8);
+/// ```
+#[macro_export]
+macro_rules! array_vec {
+ ($array_type:ty => $($elem:expr),* $(,)?) => {
+ {
+ let mut av: $crate::ArrayVec<$array_type> = Default::default();
+ $( av.push($elem); )*
+ av
+ }
+ };
+ ($array_type:ty) => {
+ $crate::ArrayVec::<$array_type>::default()
+ };
+ ($($elem:expr),*) => {
+ $crate::array_vec!(_ => $($elem),*)
+ };
+ ($elem:expr; $n:expr) => {
+ $crate::ArrayVec::from([$elem; $n])
+ };
+ () => {
+ $crate::array_vec!(_)
+ };
+}
+
+/// An array-backed, vector-like data structure.
+///
+/// * `ArrayVec` has a fixed capacity, equal to the array size.
+/// * `ArrayVec` has a variable length, as you add and remove elements. Attempts
+/// to fill the vec beyond its capacity will cause a panic.
+/// * All of the vec's array slots are always initialized in terms of Rust's
+/// memory model. When you remove a element from a location, the old value at
+/// that location is replaced with the type's default value.
+///
+/// The overall API of this type is intended to, as much as possible, emulate
+/// the API of the [`Vec`](https://doc.rust-lang.org/alloc/vec/struct.Vec.html)
+/// type.
+///
+/// ## Construction
+///
+/// You can use the `array_vec!` macro similarly to how you might use the `vec!`
+/// macro. Specify the array type, then optionally give all the initial values
+/// you want to have.
+/// ```rust
+/// # use tinyvec::*;
+/// let some_ints = array_vec!([i32; 4] => 1, 2, 3);
+/// assert_eq!(some_ints.len(), 3);
+/// ```
+///
+/// The [`default`](ArrayVec::new) for an `ArrayVec` is to have a default
+/// array with length 0. The [`new`](ArrayVec::new) method is the same as
+/// calling `default`
+/// ```rust
+/// # use tinyvec::*;
+/// let some_ints = ArrayVec::<[i32; 7]>::default();
+/// assert_eq!(some_ints.len(), 0);
+///
+/// let more_ints = ArrayVec::<[i32; 7]>::new();
+/// assert_eq!(some_ints, more_ints);
+/// ```
+///
+/// If you have an array and want the _whole thing_ so count as being "in" the
+/// new `ArrayVec` you can use one of the `from` implementations. If you want
+/// _part of_ the array then you can use
+/// [`from_array_len`](ArrayVec::from_array_len):
+/// ```rust
+/// # use tinyvec::*;
+/// let some_ints = ArrayVec::from([5, 6, 7, 8]);
+/// assert_eq!(some_ints.len(), 4);
+///
+/// let more_ints = ArrayVec::from_array_len([5, 6, 7, 8], 2);
+/// assert_eq!(more_ints.len(), 2);
+///
+/// let no_ints: ArrayVec<[u8; 5]> = ArrayVec::from_array_empty([1, 2, 3, 4, 5]);
+/// assert_eq!(no_ints.len(), 0);
+/// ```
+#[repr(C)]
+pub struct ArrayVec<A> {
+ len: u16,
+ pub(crate) data: A,
+}
+
+impl<A> Clone for ArrayVec<A>
+where
+ A: Array + Clone,
+ A::Item: Clone,
+{
+ #[inline]
+ fn clone(&self) -> Self {
+ Self { data: self.data.clone(), len: self.len }
+ }
+
+ #[inline]
+ fn clone_from(&mut self, o: &Self) {
+ let iter = self
+ .data
+ .as_slice_mut()
+ .iter_mut()
+ .zip(o.data.as_slice())
+ .take(self.len.max(o.len) as usize);
+ for (dst, src) in iter {
+ dst.clone_from(src)
+ }
+ if let Some(to_drop) =
+ self.data.as_slice_mut().get_mut((o.len as usize)..(self.len as usize))
+ {
+ to_drop.iter_mut().for_each(|x| drop(take(x)));
+ }
+ self.len = o.len;
+ }
+}
+
+impl<A> Copy for ArrayVec<A>
+where
+ A: Array + Copy,
+ A::Item: Copy,
+{
+}
+
+impl<A: Array> Default for ArrayVec<A> {
+ fn default() -> Self {
+ Self { len: 0, data: A::default() }
+ }
+}
+
+impl<A: Array> Deref for ArrayVec<A> {
+ type Target = [A::Item];
+ #[inline(always)]
+ #[must_use]
+ fn deref(&self) -> &Self::Target {
+ &self.data.as_slice()[..self.len as usize]
+ }
+}
+
+impl<A: Array> DerefMut for ArrayVec<A> {
+ #[inline(always)]
+ #[must_use]
+ fn deref_mut(&mut self) -> &mut Self::Target {
+ &mut self.data.as_slice_mut()[..self.len as usize]
+ }
+}
+
+impl<A: Array, I: SliceIndex<[A::Item]>> Index<I> for ArrayVec<A> {
+ type Output = <I as SliceIndex<[A::Item]>>::Output;
+ #[inline(always)]
+ #[must_use]
+ fn index(&self, index: I) -> &Self::Output {
+ &self.deref()[index]
+ }
+}
+
+impl<A: Array, I: SliceIndex<[A::Item]>> IndexMut<I> for ArrayVec<A> {
+ #[inline(always)]
+ #[must_use]
+ fn index_mut(&mut self, index: I) -> &mut Self::Output {
+ &mut self.deref_mut()[index]
+ }
+}
+
+#[cfg(feature = "serde")]
+#[cfg_attr(docs_rs, doc(cfg(feature = "serde")))]
+impl<A: Array> Serialize for ArrayVec<A>
+where
+ A::Item: Serialize,
+{
+ #[must_use]
+ fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
+ where
+ S: Serializer,
+ {
+ let mut seq = serializer.serialize_seq(Some(self.len()))?;
+ for element in self.iter() {
+ seq.serialize_element(element)?;
+ }
+ seq.end()
+ }
+}
+
+#[cfg(feature = "serde")]
+#[cfg_attr(docs_rs, doc(cfg(feature = "serde")))]
+impl<'de, A: Array> Deserialize<'de> for ArrayVec<A>
+where
+ A::Item: Deserialize<'de>,
+{
+ fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
+ where
+ D: Deserializer<'de>,
+ {
+ deserializer.deserialize_seq(ArrayVecVisitor(PhantomData))
+ }
+}
+
+#[cfg(all(feature = "arbitrary", feature = "nightly_const_generics"))]
+#[cfg_attr(
+ docs_rs,
+ doc(cfg(all(feature = "arbitrary", feature = "nightly_const_generics")))
+)]
+impl<'a, T, const N: usize> arbitrary::Arbitrary<'a> for ArrayVec<[T; N]>
+where
+ T: arbitrary::Arbitrary<'a> + Default,
+{
+ fn arbitrary(u: &mut arbitrary::Unstructured<'a>) -> arbitrary::Result<Self> {
+ let v = <[T; N]>::arbitrary(u)?;
+ let av = ArrayVec::from(v);
+ Ok(av)
+ }
+}
+
+impl<A: Array> ArrayVec<A> {
+ /// Move all values from `other` into this vec.
+ ///
+ /// ## Panics
+ /// * If the vec overflows its capacity
+ ///
+ /// ## Example
+ /// ```rust
+ /// # use tinyvec::*;
+ /// let mut av = array_vec!([i32; 10] => 1, 2, 3);
+ /// let mut av2 = array_vec!([i32; 10] => 4, 5, 6);
+ /// av.append(&mut av2);
+ /// assert_eq!(av, &[1, 2, 3, 4, 5, 6][..]);
+ /// assert_eq!(av2, &[][..]);
+ /// ```
+ #[inline]
+ pub fn append(&mut self, other: &mut Self) {
+ assert!(
+ self.try_append(other).is_none(),
+ "ArrayVec::append> total length {} exceeds capacity {}!",
+ self.len() + other.len(),
+ A::CAPACITY
+ );
+ }
+
+ /// Move all values from `other` into this vec.
+ /// If appending would overflow the capacity, Some(other) is returned.
+ /// ## Example
+ /// ```rust
+ /// # use tinyvec::*;
+ /// let mut av = array_vec!([i32; 7] => 1, 2, 3);
+ /// let mut av2 = array_vec!([i32; 7] => 4, 5, 6);
+ /// av.append(&mut av2);
+ /// assert_eq!(av, &[1, 2, 3, 4, 5, 6][..]);
+ /// assert_eq!(av2, &[][..]);
+ ///
+ /// let mut av3 = array_vec!([i32; 7] => 7, 8, 9);
+ /// assert!(av.try_append(&mut av3).is_some());
+ /// assert_eq!(av, &[1, 2, 3, 4, 5, 6][..]);
+ /// assert_eq!(av3, &[7, 8, 9][..]);
+ /// ```
+ #[inline]
+ pub fn try_append<'other>(
+ &mut self, other: &'other mut Self,
+ ) -> Option<&'other mut Self> {
+ let new_len = self.len() + other.len();
+ if new_len > A::CAPACITY {
+ return Some(other);
+ }
+
+ let iter = other.iter_mut().map(take);
+ for item in iter {
+ self.push(item);
+ }
+
+ other.set_len(0);
+
+ return None;
+ }
+
+ /// A `*mut` pointer to the backing array.
+ ///
+ /// ## Safety
+ ///
+ /// This pointer has provenance over the _entire_ backing array.
+ #[inline(always)]
+ #[must_use]
+ pub fn as_mut_ptr(&mut self) -> *mut A::Item {
+ self.data.as_slice_mut().as_mut_ptr()
+ }
+
+ /// Performs a `deref_mut`, into unique slice form.
+ #[inline(always)]
+ #[must_use]
+ pub fn as_mut_slice(&mut self) -> &mut [A::Item] {
+ self.deref_mut()
+ }
+
+ /// A `*const` pointer to the backing array.
+ ///
+ /// ## Safety
+ ///
+ /// This pointer has provenance over the _entire_ backing array.
+ #[inline(always)]
+ #[must_use]
+ pub fn as_ptr(&self) -> *const A::Item {
+ self.data.as_slice().as_ptr()
+ }
+
+ /// Performs a `deref`, into shared slice form.
+ #[inline(always)]
+ #[must_use]
+ pub fn as_slice(&self) -> &[A::Item] {
+ self.deref()
+ }
+
+ /// The capacity of the `ArrayVec`.
+ ///
+ /// This is fixed based on the array type, but can't yet be made a `const fn`
+ /// on Stable Rust.
+ #[inline(always)]
+ #[must_use]
+ pub fn capacity(&self) -> usize {
+ // Note: This shouldn't use A::CAPACITY, because unsafe code can't rely on
+ // any Array invariants. This ensures that at the very least, the returned
+ // value is a valid length for a subslice of the backing array.
+ self.data.as_slice().len()
+ }
+
+ /// Truncates the `ArrayVec` down to length 0.
+ #[inline(always)]
+ pub fn clear(&mut self) {
+ self.truncate(0)
+ }
+
+ /// Creates a draining iterator that removes the specified range in the vector
+ /// and yields the removed items.
+ ///
+ /// ## Panics
+ /// * If the start is greater than the end
+ /// * If the end is past the edge of the vec.
+ ///
+ /// ## Example
+ /// ```rust
+ /// # use tinyvec::*;
+ /// let mut av = array_vec!([i32; 4] => 1, 2, 3);
+ /// let av2: ArrayVec<[i32; 4]> = av.drain(1..).collect();
+ /// assert_eq!(av.as_slice(), &[1][..]);
+ /// assert_eq!(av2.as_slice(), &[2, 3][..]);
+ ///
+ /// av.drain(..);
+ /// assert_eq!(av.as_slice(), &[]);
+ /// ```
+ #[inline]
+ pub fn drain<R>(&mut self, range: R) -> ArrayVecDrain<'_, A::Item>
+ where
+ R: RangeBounds<usize>,
+ {
+ ArrayVecDrain::new(self, range)
+ }
+
+ /// Returns the inner array of the `ArrayVec`.
+ ///
+ /// This returns the full array, even if the `ArrayVec` length is currently
+ /// less than that.
+ ///
+ /// ## Example
+ ///
+ /// ```rust
+ /// # use tinyvec::{array_vec, ArrayVec};
+ /// let mut favorite_numbers = array_vec!([i32; 5] => 87, 48, 33, 9, 26);
+ /// assert_eq!(favorite_numbers.clone().into_inner(), [87, 48, 33, 9, 26]);
+ ///
+ /// favorite_numbers.pop();
+ /// assert_eq!(favorite_numbers.into_inner(), [87, 48, 33, 9, 0]);
+ /// ```
+ ///
+ /// A use for this function is to build an array from an iterator by first
+ /// collecting it into an `ArrayVec`.
+ ///
+ /// ```rust
+ /// # use tinyvec::ArrayVec;
+ /// let arr_vec: ArrayVec<[i32; 10]> = (1..=3).cycle().take(10).collect();
+ /// let inner = arr_vec.into_inner();
+ /// assert_eq!(inner, [1, 2, 3, 1, 2, 3, 1, 2, 3, 1]);
+ /// ```
+ #[inline]
+ pub fn into_inner(self) -> A {
+ self.data
+ }
+
+ /// Clone each element of the slice into this `ArrayVec`.
+ ///
+ /// ## Panics
+ /// * If the `ArrayVec` would overflow, this will panic.
+ #[inline]
+ pub fn extend_from_slice(&mut self, sli: &[A::Item])
+ where
+ A::Item: Clone,
+ {
+ if sli.is_empty() {
+ return;
+ }
+
+ let new_len = self.len as usize + sli.len();
+ assert!(
+ new_len <= A::CAPACITY,
+ "ArrayVec::extend_from_slice> total length {} exceeds capacity {}!",
+ new_len,
+ A::CAPACITY
+ );
+
+ let target = &mut self.data.as_slice_mut()[self.len as usize..new_len];
+ target.clone_from_slice(sli);
+ self.set_len(new_len);
+ }
+
+ /// Fill the vector until its capacity has been reached.
+ ///
+ /// Successively fills unused space in the spare slice of the vector with
+ /// elements from the iterator. It then returns the remaining iterator
+ /// without exhausting it. This also allows appending the head of an
+ /// infinite iterator.
+ ///
+ /// This is an alternative to `Extend::extend` method for cases where the
+ /// length of the iterator can not be checked. Since this vector can not
+ /// reallocate to increase its capacity, it is unclear what to do with
+ /// remaining elements in the iterator and the iterator itself. The
+ /// interface also provides no way to communicate this to the caller.
+ ///
+ /// ## Panics
+ /// * If the `next` method of the provided iterator panics.
+ ///
+ /// ## Example
+ ///
+ /// ```rust
+ /// # use tinyvec::*;
+ /// let mut av = array_vec!([i32; 4]);
+ /// let mut to_inf = av.fill(0..);
+ /// assert_eq!(&av[..], [0, 1, 2, 3]);
+ /// assert_eq!(to_inf.next(), Some(4));
+ /// ```
+ #[inline]
+ pub fn fill<I: IntoIterator<Item = A::Item>>(
+ &mut self, iter: I,
+ ) -> I::IntoIter {
+ // If this is written as a call to push for each element in iter, the
+ // compiler emits code that updates the length for every element. The
+ // additional complexity from that length update is worth nearly 2x in
+ // the runtime of this function.
+ let mut iter = iter.into_iter();
+ let mut pushed = 0;
+ let to_take = self.capacity() - self.len();
+ let target = &mut self.data.as_slice_mut()[self.len as usize..];
+ for element in iter.by_ref().take(to_take) {
+ target[pushed] = element;
+ pushed += 1;
+ }
+ self.len += pushed as u16;
+ iter
+ }
+
+ /// Wraps up an array and uses the given length as the initial length.
+ ///
+ /// If you want to simply use the full array, use `from` instead.
+ ///
+ /// ## Panics
+ ///
+ /// * The length specified must be less than or equal to the capacity of the
+ /// array.
+ #[inline]
+ #[must_use]
+ #[allow(clippy::match_wild_err_arm)]
+ pub fn from_array_len(data: A, len: usize) -> Self {
+ match Self::try_from_array_len(data, len) {
+ Ok(out) => out,
+ Err(_) => panic!(
+ "ArrayVec::from_array_len> length {} exceeds capacity {}!",
+ len,
+ A::CAPACITY
+ ),
+ }
+ }
+
+ /// Inserts an item at the position given, moving all following elements +1
+ /// index.
+ ///
+ /// ## Panics
+ /// * If `index` > `len`
+ /// * If the capacity is exhausted
+ ///
+ /// ## Example
+ /// ```rust
+ /// use tinyvec::*;
+ /// let mut av = array_vec!([i32; 10] => 1, 2, 3);
+ /// av.insert(1, 4);
+ /// assert_eq!(av.as_slice(), &[1, 4, 2, 3]);
+ /// av.insert(4, 5);
+ /// assert_eq!(av.as_slice(), &[1, 4, 2, 3, 5]);
+ /// ```
+ #[inline]
+ pub fn insert(&mut self, index: usize, item: A::Item) {
+ let x = self.try_insert(index, item);
+ assert!(x.is_none(), "ArrayVec::insert> capacity overflow!");
+ }
+
+ /// Tries to insert an item at the position given, moving all following
+ /// elements +1 index.
+ /// Returns back the element if the capacity is exhausted,
+ /// otherwise returns None.
+ ///
+ /// ## Panics
+ /// * If `index` > `len`
+ ///
+ /// ## Example
+ /// ```rust
+ /// use tinyvec::*;
+ /// let mut av = array_vec!([&'static str; 4] => "one", "two", "three");
+ /// av.insert(1, "four");
+ /// assert_eq!(av.as_slice(), &["one", "four", "two", "three"]);
+ /// assert_eq!(av.try_insert(4, "five"), Some("five"));
+ /// ```
+ #[inline]
+ pub fn try_insert(
+ &mut self, index: usize, mut item: A::Item,
+ ) -> Option<A::Item> {
+ assert!(
+ index <= self.len as usize,
+ "ArrayVec::try_insert> index {} is out of bounds {}",
+ index,
+ self.len
+ );
+
+ // A previous implementation used self.try_push and slice::rotate_right
+ // rotate_right and rotate_left generate a huge amount of code and fail to
+ // inline; calling them here incurs the cost of all the cases they
+ // handle even though we're rotating a usually-small array by a constant
+ // 1 offset. This swap-based implementation benchmarks much better for
+ // small array lengths in particular.
+
+ if (self.len as usize) < A::CAPACITY {
+ self.len += 1;
+ } else {
+ return Some(item);
+ }
+
+ let target = &mut self.as_mut_slice()[index..];
+ for i in 0..target.len() {
+ core::mem::swap(&mut item, &mut target[i]);
+ }
+ return None;
+ }
+
+ /// Checks if the length is 0.
+ #[inline(always)]
+ #[must_use]
+ pub fn is_empty(&self) -> bool {
+ self.len == 0
+ }
+
+ /// The length of the `ArrayVec` (in elements).
+ #[inline(always)]
+ #[must_use]
+ pub fn len(&self) -> usize {
+ self.len as usize
+ }
+
+ /// Makes a new, empty `ArrayVec`.
+ #[inline(always)]
+ #[must_use]
+ pub fn new() -> Self {
+ Self::default()
+ }
+
+ /// Remove and return the last element of the vec, if there is one.
+ ///
+ /// ## Failure
+ /// * If the vec is empty you get `None`.
+ ///
+ /// ## Example
+ /// ```rust
+ /// # use tinyvec::*;
+ /// let mut av = array_vec!([i32; 10] => 1, 2);
+ /// assert_eq!(av.pop(), Some(2));
+ /// assert_eq!(av.pop(), Some(1));
+ /// assert_eq!(av.pop(), None);
+ /// ```
+ #[inline]
+ pub fn pop(&mut self) -> Option<A::Item> {
+ if self.len > 0 {
+ self.len -= 1;
+ let out = take(&mut self.data.as_slice_mut()[self.len as usize]);
+ Some(out)
+ } else {
+ None
+ }
+ }
+
+ /// Place an element onto the end of the vec.
+ ///
+ /// ## Panics
+ /// * If the length of the vec would overflow the capacity.
+ ///
+ /// ## Example
+ /// ```rust
+ /// # use tinyvec::*;
+ /// let mut av = array_vec!([i32; 2]);
+ /// assert_eq!(&av[..], []);
+ /// av.push(1);
+ /// assert_eq!(&av[..], [1]);
+ /// av.push(2);
+ /// assert_eq!(&av[..], [1, 2]);
+ /// // av.push(3); this would overflow the ArrayVec and panic!
+ /// ```
+ #[inline(always)]
+ pub fn push(&mut self, val: A::Item) {
+ let x = self.try_push(val);
+ assert!(x.is_none(), "ArrayVec::push> capacity overflow!");
+ }
+
+ /// Tries to place an element onto the end of the vec.\
+ /// Returns back the element if the capacity is exhausted,
+ /// otherwise returns None.
+ /// ```rust
+ /// # use tinyvec::*;
+ /// let mut av = array_vec!([i32; 2]);
+ /// assert_eq!(av.as_slice(), []);
+ /// assert_eq!(av.try_push(1), None);
+ /// assert_eq!(&av[..], [1]);
+ /// assert_eq!(av.try_push(2), None);
+ /// assert_eq!(&av[..], [1, 2]);
+ /// assert_eq!(av.try_push(3), Some(3));
+ /// ```
+ #[inline(always)]
+ pub fn try_push(&mut self, val: A::Item) -> Option<A::Item> {
+ debug_assert!(self.len as usize <= A::CAPACITY);
+
+ let itemref = match self.data.as_slice_mut().get_mut(self.len as usize) {
+ None => return Some(val),
+ Some(x) => x,
+ };
+
+ *itemref = val;
+ self.len += 1;
+ return None;
+ }
+
+ /// Removes the item at `index`, shifting all others down by one index.
+ ///
+ /// Returns the removed element.
+ ///
+ /// ## Panics
+ ///
+ /// * If the index is out of bounds.
+ ///
+ /// ## Example
+ ///
+ /// ```rust
+ /// # use tinyvec::*;
+ /// let mut av = array_vec!([i32; 4] => 1, 2, 3);
+ /// assert_eq!(av.remove(1), 2);
+ /// assert_eq!(&av[..], [1, 3]);
+ /// ```
+ #[inline]
+ pub fn remove(&mut self, index: usize) -> A::Item {
+ let targets: &mut [A::Item] = &mut self.deref_mut()[index..];
+ let item = take(&mut targets[0]);
+
+ // A previous implementation used rotate_left
+ // rotate_right and rotate_left generate a huge amount of code and fail to
+ // inline; calling them here incurs the cost of all the cases they
+ // handle even though we're rotating a usually-small array by a constant
+ // 1 offset. This swap-based implementation benchmarks much better for
+ // small array lengths in particular.
+
+ for i in 0..targets.len() - 1 {
+ targets.swap(i, i + 1);
+ }
+ self.len -= 1;
+ item
+ }
+
+ /// As [`resize_with`](ArrayVec::resize_with)
+ /// and it clones the value as the closure.
+ ///
+ /// ## Example
+ ///
+ /// ```rust
+ /// # use tinyvec::*;
+ ///
+ /// let mut av = array_vec!([&str; 10] => "hello");
+ /// av.resize(3, "world");
+ /// assert_eq!(&av[..], ["hello", "world", "world"]);
+ ///
+ /// let mut av = array_vec!([i32; 10] => 1, 2, 3, 4);
+ /// av.resize(2, 0);
+ /// assert_eq!(&av[..], [1, 2]);
+ /// ```
+ #[inline]
+ pub fn resize(&mut self, new_len: usize, new_val: A::Item)
+ where
+ A::Item: Clone,
+ {
+ self.resize_with(new_len, || new_val.clone())
+ }
+
+ /// Resize the vec to the new length.
+ ///
+ /// If it needs to be longer, it's filled with repeated calls to the provided
+ /// function. If it needs to be shorter, it's truncated.
+ ///
+ /// ## Example
+ ///
+ /// ```rust
+ /// # use tinyvec::*;
+ ///
+ /// let mut av = array_vec!([i32; 10] => 1, 2, 3);
+ /// av.resize_with(5, Default::default);
+ /// assert_eq!(&av[..], [1, 2, 3, 0, 0]);
+ ///
+ /// let mut av = array_vec!([i32; 10]);
+ /// let mut p = 1;
+ /// av.resize_with(4, || {
+ /// p *= 2;
+ /// p
+ /// });
+ /// assert_eq!(&av[..], [2, 4, 8, 16]);
+ /// ```
+ #[inline]
+ pub fn resize_with<F: FnMut() -> A::Item>(
+ &mut self, new_len: usize, mut f: F,
+ ) {
+ match new_len.checked_sub(self.len as usize) {
+ None => self.truncate(new_len),
+ Some(new_elements) => {
+ for _ in 0..new_elements {
+ self.push(f());
+ }
+ }
+ }
+ }
+
+ /// Walk the vec and keep only the elements that pass the predicate given.
+ ///
+ /// ## Example
+ ///
+ /// ```rust
+ /// # use tinyvec::*;
+ ///
+ /// let mut av = array_vec!([i32; 10] => 1, 1, 2, 3, 3, 4);
+ /// av.retain(|&x| x % 2 == 0);
+ /// assert_eq!(&av[..], [2, 4]);
+ /// ```
+ #[inline]
+ pub fn retain<F: FnMut(&A::Item) -> bool>(&mut self, mut acceptable: F) {
+ // Drop guard to contain exactly the remaining elements when the test
+ // panics.
+ struct JoinOnDrop<'vec, Item> {
+ items: &'vec mut [Item],
+ done_end: usize,
+ // Start of tail relative to `done_end`.
+ tail_start: usize,
+ }
+
+ impl<Item> Drop for JoinOnDrop<'_, Item> {
+ fn drop(&mut self) {
+ self.items[self.done_end..].rotate_left(self.tail_start);
+ }
+ }
+
+ let mut rest = JoinOnDrop {
+ items: &mut self.data.as_slice_mut()[..self.len as usize],
+ done_end: 0,
+ tail_start: 0,
+ };
+
+ let len = self.len as usize;
+ for idx in 0..len {
+ // Loop start invariant: idx = rest.done_end + rest.tail_start
+ if !acceptable(&rest.items[idx]) {
+ let _ = take(&mut rest.items[idx]);
+ self.len -= 1;
+ rest.tail_start += 1;
+ } else {
+ rest.items.swap(rest.done_end, idx);
+ rest.done_end += 1;
+ }
+ }
+ }
+
+ /// Forces the length of the vector to `new_len`.
+ ///
+ /// ## Panics
+ /// * If `new_len` is greater than the vec's capacity.
+ ///
+ /// ## Safety
+ /// * This is a fully safe operation! The inactive memory already counts as
+ /// "initialized" by Rust's rules.
+ /// * Other than "the memory is initialized" there are no other guarantees
+ /// regarding what you find in the inactive portion of the vec.
+ #[inline(always)]
+ pub fn set_len(&mut self, new_len: usize) {
+ if new_len > A::CAPACITY {
+ // Note(Lokathor): Technically we don't have to panic here, and we could
+ // just let some other call later on trigger a panic on accident when the
+ // length is wrong. However, it's a lot easier to catch bugs when things
+ // are more "fail-fast".
+ panic!(
+ "ArrayVec::set_len> new length {} exceeds capacity {}",
+ new_len,
+ A::CAPACITY
+ )
+ }
+
+ let new_len: u16 = new_len
+ .try_into()
+ .expect("ArrayVec::set_len> new length is not in range 0..=u16::MAX");
+ self.len = new_len;
+ }
+
+ /// Splits the collection at the point given.
+ ///
+ /// * `[0, at)` stays in this vec
+ /// * `[at, len)` ends up in the new vec.
+ ///
+ /// ## Panics
+ /// * if at > len
+ ///
+ /// ## Example
+ ///
+ /// ```rust
+ /// # use tinyvec::*;
+ /// let mut av = array_vec!([i32; 4] => 1, 2, 3);
+ /// let av2 = av.split_off(1);
+ /// assert_eq!(&av[..], [1]);
+ /// assert_eq!(&av2[..], [2, 3]);
+ /// ```
+ #[inline]
+ pub fn split_off(&mut self, at: usize) -> Self {
+ // FIXME: should this just use drain into the output?
+ if at > self.len() {
+ panic!(
+ "ArrayVec::split_off> at value {} exceeds length of {}",
+ at, self.len
+ );
+ }
+ let mut new = Self::default();
+ let moves = &mut self.as_mut_slice()[at..];
+ let split_len = moves.len();
+ let targets = &mut new.data.as_slice_mut()[..split_len];
+ moves.swap_with_slice(targets);
+
+ /* moves.len() <= u16::MAX, so these are surely in u16 range */
+ new.len = split_len as u16;
+ self.len = at as u16;
+ new
+ }
+
+ /// Creates a splicing iterator that removes the specified range in the
+ /// vector, yields the removed items, and replaces them with elements from
+ /// the provided iterator.
+ ///
+ /// `splice` fuses the provided iterator, so elements after the first `None`
+ /// are ignored.
+ ///
+ /// ## Panics
+ /// * If the start is greater than the end.
+ /// * If the end is past the edge of the vec.
+ /// * If the provided iterator panics.
+ /// * If the new length would overflow the capacity of the array. Because
+ /// `ArrayVecSplice` adds elements to this vec in its destructor when
+ /// necessary, this panic would occur when it is dropped.
+ ///
+ /// ## Example
+ /// ```rust
+ /// use tinyvec::*;
+ /// let mut av = array_vec!([i32; 4] => 1, 2, 3);
+ /// let av2: ArrayVec<[i32; 4]> = av.splice(1.., 4..=6).collect();
+ /// assert_eq!(av.as_slice(), &[1, 4, 5, 6][..]);
+ /// assert_eq!(av2.as_slice(), &[2, 3][..]);
+ ///
+ /// av.splice(.., None);
+ /// assert_eq!(av.as_slice(), &[]);
+ /// ```
+ #[inline]
+ pub fn splice<R, I>(
+ &mut self, range: R, replacement: I,
+ ) -> ArrayVecSplice<'_, A, core::iter::Fuse<I::IntoIter>>
+ where
+ R: RangeBounds<usize>,
+ I: IntoIterator<Item = A::Item>,
+ {
+ use core::ops::Bound;
+ let start = match range.start_bound() {
+ Bound::Included(x) => *x,
+ Bound::Excluded(x) => x.saturating_add(1),
+ Bound::Unbounded => 0,
+ };
+ let end = match range.end_bound() {
+ Bound::Included(x) => x.saturating_add(1),
+ Bound::Excluded(x) => *x,
+ Bound::Unbounded => self.len(),
+ };
+ assert!(
+ start <= end,
+ "ArrayVec::splice> Illegal range, {} to {}",
+ start,
+ end
+ );
+ assert!(
+ end <= self.len(),
+ "ArrayVec::splice> Range ends at {} but length is only {}!",
+ end,
+ self.len()
+ );
+
+ ArrayVecSplice {
+ removal_start: start,
+ removal_end: end,
+ parent: self,
+ replacement: replacement.into_iter().fuse(),
+ }
+ }
+
+ /// Remove an element, swapping the end of the vec into its place.
+ ///
+ /// ## Panics
+ /// * If the index is out of bounds.
+ ///
+ /// ## Example
+ /// ```rust
+ /// # use tinyvec::*;
+ /// let mut av = array_vec!([&str; 4] => "foo", "bar", "quack", "zap");
+ ///
+ /// assert_eq!(av.swap_remove(1), "bar");
+ /// assert_eq!(&av[..], ["foo", "zap", "quack"]);
+ ///
+ /// assert_eq!(av.swap_remove(0), "foo");
+ /// assert_eq!(&av[..], ["quack", "zap"]);
+ /// ```
+ #[inline]
+ pub fn swap_remove(&mut self, index: usize) -> A::Item {
+ assert!(
+ index < self.len(),
+ "ArrayVec::swap_remove> index {} is out of bounds {}",
+ index,
+ self.len
+ );
+ if index == self.len() - 1 {
+ self.pop().unwrap()
+ } else {
+ let i = self.pop().unwrap();
+ replace(&mut self[index], i)
+ }
+ }
+
+ /// Reduces the vec's length to the given value.
+ ///
+ /// If the vec is already shorter than the input, nothing happens.
+ #[inline]
+ pub fn truncate(&mut self, new_len: usize) {
+ if new_len >= self.len as usize {
+ return;
+ }
+
+ if needs_drop::<A::Item>() {
+ let len = self.len as usize;
+ self.data.as_slice_mut()[new_len..len]
+ .iter_mut()
+ .map(take)
+ .for_each(drop);
+ }
+
+ /* new_len is less than self.len */
+ self.len = new_len as u16;
+ }
+
+ /// Wraps an array, using the given length as the starting length.
+ ///
+ /// If you want to use the whole length of the array, you can just use the
+ /// `From` impl.
+ ///
+ /// ## Failure
+ ///
+ /// If the given length is greater than the capacity of the array this will
+ /// error, and you'll get the array back in the `Err`.
+ #[inline]
+ pub fn try_from_array_len(data: A, len: usize) -> Result<Self, A> {
+ /* Note(Soveu): Should we allow A::CAPACITY > u16::MAX for now? */
+ if len <= A::CAPACITY {
+ Ok(Self { data, len: len as u16 })
+ } else {
+ Err(data)
+ }
+ }
+}
+
+impl<A> ArrayVec<A> {
+ /// Wraps up an array as a new empty `ArrayVec`.
+ ///
+ /// If you want to simply use the full array, use `from` instead.
+ ///
+ /// ## Examples
+ ///
+ /// This method in particular allows to create values for statics:
+ ///
+ /// ```rust
+ /// # use tinyvec::ArrayVec;
+ /// static DATA: ArrayVec<[u8; 5]> = ArrayVec::from_array_empty([0; 5]);
+ /// assert_eq!(DATA.len(), 0);
+ /// ```
+ ///
+ /// But of course it is just an normal empty `ArrayVec`:
+ ///
+ /// ```rust
+ /// # use tinyvec::ArrayVec;
+ /// let mut data = ArrayVec::from_array_empty([1, 2, 3, 4]);
+ /// assert_eq!(&data[..], &[]);
+ /// data.push(42);
+ /// assert_eq!(&data[..], &[42]);
+ /// ```
+ #[inline]
+ #[must_use]
+ pub const fn from_array_empty(data: A) -> Self {
+ Self { data, len: 0 }
+ }
+}
+
+#[cfg(feature = "grab_spare_slice")]
+impl<A: Array> ArrayVec<A> {
+ /// Obtain the shared slice of the array _after_ the active memory.
+ ///
+ /// ## Example
+ /// ```rust
+ /// # use tinyvec::*;
+ /// let mut av = array_vec!([i32; 4]);
+ /// assert_eq!(av.grab_spare_slice().len(), 4);
+ /// av.push(10);
+ /// av.push(11);
+ /// av.push(12);
+ /// av.push(13);
+ /// assert_eq!(av.grab_spare_slice().len(), 0);
+ /// ```
+ #[inline(always)]
+ pub fn grab_spare_slice(&self) -> &[A::Item] {
+ &self.data.as_slice()[self.len as usize..]
+ }
+
+ /// Obtain the mutable slice of the array _after_ the active memory.
+ ///
+ /// ## Example
+ /// ```rust
+ /// # use tinyvec::*;
+ /// let mut av = array_vec!([i32; 4]);
+ /// assert_eq!(av.grab_spare_slice_mut().len(), 4);
+ /// av.push(10);
+ /// av.push(11);
+ /// assert_eq!(av.grab_spare_slice_mut().len(), 2);
+ /// ```
+ #[inline(always)]
+ pub fn grab_spare_slice_mut(&mut self) -> &mut [A::Item] {
+ &mut self.data.as_slice_mut()[self.len as usize..]
+ }
+}
+
+#[cfg(feature = "nightly_slice_partition_dedup")]
+impl<A: Array> ArrayVec<A> {
+ /// De-duplicates the vec contents.
+ #[inline(always)]
+ pub fn dedup(&mut self)
+ where
+ A::Item: PartialEq,
+ {
+ self.dedup_by(|a, b| a == b)
+ }
+
+ /// De-duplicates the vec according to the predicate given.
+ #[inline(always)]
+ pub fn dedup_by<F>(&mut self, same_bucket: F)
+ where
+ F: FnMut(&mut A::Item, &mut A::Item) -> bool,
+ {
+ let len = {
+ let (dedup, _) = self.as_mut_slice().partition_dedup_by(same_bucket);
+ dedup.len()
+ };
+ self.truncate(len);
+ }
+
+ /// De-duplicates the vec according to the key selector given.
+ #[inline(always)]
+ pub fn dedup_by_key<F, K>(&mut self, mut key: F)
+ where
+ F: FnMut(&mut A::Item) -> K,
+ K: PartialEq,
+ {
+ self.dedup_by(|a, b| key(a) == key(b))
+ }
+}
+
+/// Splicing iterator for `ArrayVec`
+/// See [`ArrayVec::splice`](ArrayVec::<A>::splice)
+pub struct ArrayVecSplice<'p, A: Array, I: Iterator<Item = A::Item>> {
+ parent: &'p mut ArrayVec<A>,
+ removal_start: usize,
+ removal_end: usize,
+ replacement: I,
+}
+
+impl<'p, A: Array, I: Iterator<Item = A::Item>> Iterator
+ for ArrayVecSplice<'p, A, I>
+{
+ type Item = A::Item;
+
+ #[inline]
+ fn next(&mut self) -> Option<A::Item> {
+ if self.removal_start < self.removal_end {
+ match self.replacement.next() {
+ Some(replacement) => {
+ let removed = core::mem::replace(
+ &mut self.parent[self.removal_start],
+ replacement,
+ );
+ self.removal_start += 1;
+ Some(removed)
+ }
+ None => {
+ let removed = self.parent.remove(self.removal_start);
+ self.removal_end -= 1;
+ Some(removed)
+ }
+ }
+ } else {
+ None
+ }
+ }
+
+ #[inline]
+ fn size_hint(&self) -> (usize, Option<usize>) {
+ let len = self.len();
+ (len, Some(len))
+ }
+}
+
+impl<'p, A, I> ExactSizeIterator for ArrayVecSplice<'p, A, I>
+where
+ A: Array,
+ I: Iterator<Item = A::Item>,
+{
+ #[inline]
+ fn len(&self) -> usize {
+ self.removal_end - self.removal_start
+ }
+}
+
+impl<'p, A, I> FusedIterator for ArrayVecSplice<'p, A, I>
+where
+ A: Array,
+ I: Iterator<Item = A::Item>,
+{
+}
+
+impl<'p, A, I> DoubleEndedIterator for ArrayVecSplice<'p, A, I>
+where
+ A: Array,
+ I: Iterator<Item = A::Item> + DoubleEndedIterator,
+{
+ #[inline]
+ fn next_back(&mut self) -> Option<A::Item> {
+ if self.removal_start < self.removal_end {
+ match self.replacement.next_back() {
+ Some(replacement) => {
+ let removed = core::mem::replace(
+ &mut self.parent[self.removal_end - 1],
+ replacement,
+ );
+ self.removal_end -= 1;
+ Some(removed)
+ }
+ None => {
+ let removed = self.parent.remove(self.removal_end - 1);
+ self.removal_end -= 1;
+ Some(removed)
+ }
+ }
+ } else {
+ None
+ }
+ }
+}
+
+impl<'p, A: Array, I: Iterator<Item = A::Item>> Drop
+ for ArrayVecSplice<'p, A, I>
+{
+ fn drop(&mut self) {
+ for _ in self.by_ref() {}
+
+ // FIXME: reserve lower bound of size_hint
+
+ for replacement in self.replacement.by_ref() {
+ self.parent.insert(self.removal_end, replacement);
+ self.removal_end += 1;
+ }
+ }
+}
+
+impl<A: Array> AsMut<[A::Item]> for ArrayVec<A> {
+ #[inline(always)]
+ #[must_use]
+ fn as_mut(&mut self) -> &mut [A::Item] {
+ &mut *self
+ }
+}
+
+impl<A: Array> AsRef<[A::Item]> for ArrayVec<A> {
+ #[inline(always)]
+ #[must_use]
+ fn as_ref(&self) -> &[A::Item] {
+ &*self
+ }
+}
+
+impl<A: Array> Borrow<[A::Item]> for ArrayVec<A> {
+ #[inline(always)]
+ #[must_use]
+ fn borrow(&self) -> &[A::Item] {
+ &*self
+ }
+}
+
+impl<A: Array> BorrowMut<[A::Item]> for ArrayVec<A> {
+ #[inline(always)]
+ #[must_use]
+ fn borrow_mut(&mut self) -> &mut [A::Item] {
+ &mut *self
+ }
+}
+
+impl<A: Array> Extend<A::Item> for ArrayVec<A> {
+ #[inline]
+ fn extend<T: IntoIterator<Item = A::Item>>(&mut self, iter: T) {
+ for t in iter {
+ self.push(t)
+ }
+ }
+}
+
+impl<A: Array> From<A> for ArrayVec<A> {
+ #[inline(always)]
+ #[must_use]
+ /// The output has a length equal to the full array.
+ ///
+ /// If you want to select a length, use
+ /// [`from_array_len`](ArrayVec::from_array_len)
+ fn from(data: A) -> Self {
+ let len: u16 = data
+ .as_slice()
+ .len()
+ .try_into()
+ .expect("ArrayVec::from> length must be in range 0..=u16::MAX");
+ Self { len, data }
+ }
+}
+
+/// The error type returned when a conversion from a slice to an [`ArrayVec`]
+/// fails.
+#[derive(Debug, Copy, Clone)]
+pub struct TryFromSliceError(());
+
+impl core::fmt::Display for TryFromSliceError {
+ fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result {
+ f.write_str("could not convert slice to ArrayVec")
+ }
+}
+
+#[cfg(feature = "std")]
+impl std::error::Error for TryFromSliceError {}
+
+impl<T, A> TryFrom<&'_ [T]> for ArrayVec<A>
+where
+ T: Clone + Default,
+ A: Array<Item = T>,
+{
+ type Error = TryFromSliceError;
+
+ #[inline]
+ #[must_use]
+ /// The output has a length equal to that of the slice, with the same capacity
+ /// as `A`.
+ fn try_from(slice: &[T]) -> Result<Self, Self::Error> {
+ if slice.len() > A::CAPACITY {
+ Err(TryFromSliceError(()))
+ } else {
+ let mut arr = ArrayVec::new();
+ // We do not use ArrayVec::extend_from_slice, because it looks like LLVM
+ // fails to deduplicate all the length-checking logic between the
+ // above if and the contents of that method, thus producing much
+ // slower code. Unlike many of the other optimizations in this
+ // crate, this one is worth keeping an eye on. I see no reason, for
+ // any element type, that these should produce different code. But
+ // they do. (rustc 1.51.0)
+ arr.set_len(slice.len());
+ arr.as_mut_slice().clone_from_slice(slice);
+ Ok(arr)
+ }
+ }
+}
+
+impl<A: Array> FromIterator<A::Item> for ArrayVec<A> {
+ #[inline]
+ #[must_use]
+ fn from_iter<T: IntoIterator<Item = A::Item>>(iter: T) -> Self {
+ let mut av = Self::default();
+ for i in iter {
+ av.push(i)
+ }
+ av
+ }
+}
+
+/// Iterator for consuming an `ArrayVec` and returning owned elements.
+pub struct ArrayVecIterator<A: Array> {
+ base: u16,
+ tail: u16,
+ data: A,
+}
+
+impl<A: Array> ArrayVecIterator<A> {
+ /// Returns the remaining items of this iterator as a slice.
+ #[inline]
+ #[must_use]
+ pub fn as_slice(&self) -> &[A::Item] {
+ &self.data.as_slice()[self.base as usize..self.tail as usize]
+ }
+}
+impl<A: Array> FusedIterator for ArrayVecIterator<A> {}
+impl<A: Array> Iterator for ArrayVecIterator<A> {
+ type Item = A::Item;
+ #[inline]
+ fn next(&mut self) -> Option<Self::Item> {
+ let slice =
+ &mut self.data.as_slice_mut()[self.base as usize..self.tail as usize];
+ let itemref = slice.first_mut()?;
+ self.base += 1;
+ return Some(take(itemref));
+ }
+ #[inline(always)]
+ #[must_use]
+ fn size_hint(&self) -> (usize, Option<usize>) {
+ let s = self.tail - self.base;
+ let s = s as usize;
+ (s, Some(s))
+ }
+ #[inline(always)]
+ fn count(self) -> usize {
+ self.size_hint().0
+ }
+ #[inline]
+ fn last(mut self) -> Option<Self::Item> {
+ self.next_back()
+ }
+ #[inline]
+ fn nth(&mut self, n: usize) -> Option<A::Item> {
+ let slice = &mut self.data.as_slice_mut();
+ let slice = &mut slice[self.base as usize..self.tail as usize];
+
+ if let Some(x) = slice.get_mut(n) {
+ /* n is in range [0 .. self.tail - self.base) so in u16 range */
+ self.base += n as u16 + 1;
+ return Some(take(x));
+ }
+
+ self.base = self.tail;
+ return None;
+ }
+}
+
+impl<A: Array> DoubleEndedIterator for ArrayVecIterator<A> {
+ #[inline]
+ fn next_back(&mut self) -> Option<Self::Item> {
+ let slice =
+ &mut self.data.as_slice_mut()[self.base as usize..self.tail as usize];
+ let item = slice.last_mut()?;
+ self.tail -= 1;
+ return Some(take(item));
+ }
+ #[cfg(feature = "rustc_1_40")]
+ #[inline]
+ fn nth_back(&mut self, n: usize) -> Option<Self::Item> {
+ let base = self.base as usize;
+ let tail = self.tail as usize;
+ let slice = &mut self.data.as_slice_mut()[base..tail];
+ let n = n.saturating_add(1);
+
+ if let Some(n) = slice.len().checked_sub(n) {
+ let item = &mut slice[n];
+ /* n is in [0..self.tail - self.base] range, so in u16 range */
+ self.tail = self.base + n as u16;
+ return Some(take(item));
+ }
+
+ self.tail = self.base;
+ return None;
+ }
+}
+
+impl<A: Array> Debug for ArrayVecIterator<A>
+where
+ A::Item: Debug,
+{
+ #[allow(clippy::missing_inline_in_public_items)]
+ fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result {
+ f.debug_tuple("ArrayVecIterator").field(&self.as_slice()).finish()
+ }
+}
+
+impl<A: Array> IntoIterator for ArrayVec<A> {
+ type Item = A::Item;
+ type IntoIter = ArrayVecIterator<A>;
+ #[inline(always)]
+ #[must_use]
+ fn into_iter(self) -> Self::IntoIter {
+ ArrayVecIterator { base: 0, tail: self.len, data: self.data }
+ }
+}
+
+impl<'a, A: Array> IntoIterator for &'a mut ArrayVec<A> {
+ type Item = &'a mut A::Item;
+ type IntoIter = core::slice::IterMut<'a, A::Item>;
+ #[inline(always)]
+ #[must_use]
+ fn into_iter(self) -> Self::IntoIter {
+ self.iter_mut()
+ }
+}
+
+impl<'a, A: Array> IntoIterator for &'a ArrayVec<A> {
+ type Item = &'a A::Item;
+ type IntoIter = core::slice::Iter<'a, A::Item>;
+ #[inline(always)]
+ #[must_use]
+ fn into_iter(self) -> Self::IntoIter {
+ self.iter()
+ }
+}
+
+impl<A: Array> PartialEq for ArrayVec<A>
+where
+ A::Item: PartialEq,
+{
+ #[inline]
+ #[must_use]
+ fn eq(&self, other: &Self) -> bool {
+ self.as_slice().eq(other.as_slice())
+ }
+}
+impl<A: Array> Eq for ArrayVec<A> where A::Item: Eq {}
+
+impl<A: Array> PartialOrd for ArrayVec<A>
+where
+ A::Item: PartialOrd,
+{
+ #[inline]
+ #[must_use]
+ fn partial_cmp(&self, other: &Self) -> Option<core::cmp::Ordering> {
+ self.as_slice().partial_cmp(other.as_slice())
+ }
+}
+impl<A: Array> Ord for ArrayVec<A>
+where
+ A::Item: Ord,
+{
+ #[inline]
+ #[must_use]
+ fn cmp(&self, other: &Self) -> core::cmp::Ordering {
+ self.as_slice().cmp(other.as_slice())
+ }
+}
+
+impl<A: Array> PartialEq<&A> for ArrayVec<A>
+where
+ A::Item: PartialEq,
+{
+ #[inline]
+ #[must_use]
+ fn eq(&self, other: &&A) -> bool {
+ self.as_slice().eq(other.as_slice())
+ }
+}
+
+impl<A: Array> PartialEq<&[A::Item]> for ArrayVec<A>
+where
+ A::Item: PartialEq,
+{
+ #[inline]
+ #[must_use]
+ fn eq(&self, other: &&[A::Item]) -> bool {
+ self.as_slice().eq(*other)
+ }
+}
+
+impl<A: Array> Hash for ArrayVec<A>
+where
+ A::Item: Hash,
+{
+ #[inline]
+ fn hash<H: Hasher>(&self, state: &mut H) {
+ self.as_slice().hash(state)
+ }
+}
+
+#[cfg(feature = "experimental_write_impl")]
+impl<A: Array<Item = u8>> core::fmt::Write for ArrayVec<A> {
+ fn write_str(&mut self, s: &str) -> core::fmt::Result {
+ let my_len = self.len();
+ let str_len = s.as_bytes().len();
+ if my_len + str_len <= A::CAPACITY {
+ let remainder = &mut self.data.as_slice_mut()[my_len..];
+ let target = &mut remainder[..str_len];
+ target.copy_from_slice(s.as_bytes());
+ Ok(())
+ } else {
+ Err(core::fmt::Error)
+ }
+ }
+}
+
+// // // // // // // //
+// Formatting impls
+// // // // // // // //
+
+impl<A: Array> Binary for ArrayVec<A>
+where
+ A::Item: Binary,
+{
+ #[allow(clippy::missing_inline_in_public_items)]
+ fn fmt(&self, f: &mut Formatter) -> core::fmt::Result {
+ write!(f, "[")?;
+ if f.alternate() {
+ write!(f, "\n ")?;
+ }
+ for (i, elem) in self.iter().enumerate() {
+ if i > 0 {
+ write!(f, ",{}", if f.alternate() { "\n " } else { " " })?;
+ }
+ Binary::fmt(elem, f)?;
+ }
+ if f.alternate() {
+ write!(f, ",\n")?;
+ }
+ write!(f, "]")
+ }
+}
+
+impl<A: Array> Debug for ArrayVec<A>
+where
+ A::Item: Debug,
+{
+ #[allow(clippy::missing_inline_in_public_items)]
+ fn fmt(&self, f: &mut Formatter) -> core::fmt::Result {
+ write!(f, "[")?;
+ if f.alternate() {
+ write!(f, "\n ")?;
+ }
+ for (i, elem) in self.iter().enumerate() {
+ if i > 0 {
+ write!(f, ",{}", if f.alternate() { "\n " } else { " " })?;
+ }
+ Debug::fmt(elem, f)?;
+ }
+ if f.alternate() {
+ write!(f, ",\n")?;
+ }
+ write!(f, "]")
+ }
+}
+
+impl<A: Array> Display for ArrayVec<A>
+where
+ A::Item: Display,
+{
+ #[allow(clippy::missing_inline_in_public_items)]
+ fn fmt(&self, f: &mut Formatter) -> core::fmt::Result {
+ write!(f, "[")?;
+ if f.alternate() {
+ write!(f, "\n ")?;
+ }
+ for (i, elem) in self.iter().enumerate() {
+ if i > 0 {
+ write!(f, ",{}", if f.alternate() { "\n " } else { " " })?;
+ }
+ Display::fmt(elem, f)?;
+ }
+ if f.alternate() {
+ write!(f, ",\n")?;
+ }
+ write!(f, "]")
+ }
+}
+
+impl<A: Array> LowerExp for ArrayVec<A>
+where
+ A::Item: LowerExp,
+{
+ #[allow(clippy::missing_inline_in_public_items)]
+ fn fmt(&self, f: &mut Formatter) -> core::fmt::Result {
+ write!(f, "[")?;
+ if f.alternate() {
+ write!(f, "\n ")?;
+ }
+ for (i, elem) in self.iter().enumerate() {
+ if i > 0 {
+ write!(f, ",{}", if f.alternate() { "\n " } else { " " })?;
+ }
+ LowerExp::fmt(elem, f)?;
+ }
+ if f.alternate() {
+ write!(f, ",\n")?;
+ }
+ write!(f, "]")
+ }
+}
+
+impl<A: Array> LowerHex for ArrayVec<A>
+where
+ A::Item: LowerHex,
+{
+ #[allow(clippy::missing_inline_in_public_items)]
+ fn fmt(&self, f: &mut Formatter) -> core::fmt::Result {
+ write!(f, "[")?;
+ if f.alternate() {
+ write!(f, "\n ")?;
+ }
+ for (i, elem) in self.iter().enumerate() {
+ if i > 0 {
+ write!(f, ",{}", if f.alternate() { "\n " } else { " " })?;
+ }
+ LowerHex::fmt(elem, f)?;
+ }
+ if f.alternate() {
+ write!(f, ",\n")?;
+ }
+ write!(f, "]")
+ }
+}
+
+impl<A: Array> Octal for ArrayVec<A>
+where
+ A::Item: Octal,
+{
+ #[allow(clippy::missing_inline_in_public_items)]
+ fn fmt(&self, f: &mut Formatter) -> core::fmt::Result {
+ write!(f, "[")?;
+ if f.alternate() {
+ write!(f, "\n ")?;
+ }
+ for (i, elem) in self.iter().enumerate() {
+ if i > 0 {
+ write!(f, ",{}", if f.alternate() { "\n " } else { " " })?;
+ }
+ Octal::fmt(elem, f)?;
+ }
+ if f.alternate() {
+ write!(f, ",\n")?;
+ }
+ write!(f, "]")
+ }
+}
+
+impl<A: Array> Pointer for ArrayVec<A>
+where
+ A::Item: Pointer,
+{
+ #[allow(clippy::missing_inline_in_public_items)]
+ fn fmt(&self, f: &mut Formatter) -> core::fmt::Result {
+ write!(f, "[")?;
+ if f.alternate() {
+ write!(f, "\n ")?;
+ }
+ for (i, elem) in self.iter().enumerate() {
+ if i > 0 {
+ write!(f, ",{}", if f.alternate() { "\n " } else { " " })?;
+ }
+ Pointer::fmt(elem, f)?;
+ }
+ if f.alternate() {
+ write!(f, ",\n")?;
+ }
+ write!(f, "]")
+ }
+}
+
+impl<A: Array> UpperExp for ArrayVec<A>
+where
+ A::Item: UpperExp,
+{
+ #[allow(clippy::missing_inline_in_public_items)]
+ fn fmt(&self, f: &mut Formatter) -> core::fmt::Result {
+ write!(f, "[")?;
+ if f.alternate() {
+ write!(f, "\n ")?;
+ }
+ for (i, elem) in self.iter().enumerate() {
+ if i > 0 {
+ write!(f, ",{}", if f.alternate() { "\n " } else { " " })?;
+ }
+ UpperExp::fmt(elem, f)?;
+ }
+ if f.alternate() {
+ write!(f, ",\n")?;
+ }
+ write!(f, "]")
+ }
+}
+
+impl<A: Array> UpperHex for ArrayVec<A>
+where
+ A::Item: UpperHex,
+{
+ #[allow(clippy::missing_inline_in_public_items)]
+ fn fmt(&self, f: &mut Formatter) -> core::fmt::Result {
+ write!(f, "[")?;
+ if f.alternate() {
+ write!(f, "\n ")?;
+ }
+ for (i, elem) in self.iter().enumerate() {
+ if i > 0 {
+ write!(f, ",{}", if f.alternate() { "\n " } else { " " })?;
+ }
+ UpperHex::fmt(elem, f)?;
+ }
+ if f.alternate() {
+ write!(f, ",\n")?;
+ }
+ write!(f, "]")
+ }
+}
+
+#[cfg(feature = "alloc")]
+use alloc::vec::Vec;
+
+#[cfg(all(feature = "alloc", feature = "rustc_1_57"))]
+use alloc::collections::TryReserveError;
+
+#[cfg(feature = "alloc")]
+impl<A: Array> ArrayVec<A> {
+ /// Drains all elements to a Vec, but reserves additional space
+ /// ```
+ /// # use tinyvec::*;
+ /// let mut av = array_vec!([i32; 7] => 1, 2, 3);
+ /// let v = av.drain_to_vec_and_reserve(10);
+ /// assert_eq!(v, &[1, 2, 3]);
+ /// assert_eq!(v.capacity(), 13);
+ /// ```
+ pub fn drain_to_vec_and_reserve(&mut self, n: usize) -> Vec<A::Item> {
+ let cap = n + self.len();
+ let mut v = Vec::with_capacity(cap);
+ let iter = self.iter_mut().map(take);
+ v.extend(iter);
+ self.set_len(0);
+ return v;
+ }
+
+ /// Tries to drain all elements to a Vec, but reserves additional space.
+ ///
+ /// # Errors
+ ///
+ /// If the allocator reports a failure, then an error is returned.
+ ///
+ /// ```
+ /// # use tinyvec::*;
+ /// let mut av = array_vec!([i32; 7] => 1, 2, 3);
+ /// let v = av.try_drain_to_vec_and_reserve(10);
+ /// assert!(matches!(v, Ok(_)));
+ /// let v = v.unwrap();
+ /// assert_eq!(v, &[1, 2, 3]);
+ /// assert_eq!(v.capacity(), 13);
+ /// ```
+ #[cfg(feature = "rustc_1_57")]
+ pub fn try_drain_to_vec_and_reserve(
+ &mut self, n: usize,
+ ) -> Result<Vec<A::Item>, TryReserveError> {
+ let cap = n + self.len();
+ let mut v = Vec::new();
+ v.try_reserve(cap)?;
+ let iter = self.iter_mut().map(take);
+ v.extend(iter);
+ self.set_len(0);
+ return Ok(v);
+ }
+
+ /// Drains all elements to a Vec
+ /// ```
+ /// # use tinyvec::*;
+ /// let mut av = array_vec!([i32; 7] => 1, 2, 3);
+ /// let v = av.drain_to_vec();
+ /// assert_eq!(v, &[1, 2, 3]);
+ /// assert_eq!(v.capacity(), 3);
+ /// ```
+ pub fn drain_to_vec(&mut self) -> Vec<A::Item> {
+ self.drain_to_vec_and_reserve(0)
+ }
+
+ /// Tries to drain all elements to a Vec.
+ ///
+ /// # Errors
+ ///
+ /// If the allocator reports a failure, then an error is returned.
+ ///
+ /// ```
+ /// # use tinyvec::*;
+ /// let mut av = array_vec!([i32; 7] => 1, 2, 3);
+ /// let v = av.try_drain_to_vec();
+ /// assert!(matches!(v, Ok(_)));
+ /// let v = v.unwrap();
+ /// assert_eq!(v, &[1, 2, 3]);
+ /// // Vec may reserve more than necessary in order to prevent more future allocations.
+ /// assert!(v.capacity() >= 3);
+ /// ```
+ #[cfg(feature = "rustc_1_57")]
+ pub fn try_drain_to_vec(&mut self) -> Result<Vec<A::Item>, TryReserveError> {
+ self.try_drain_to_vec_and_reserve(0)
+ }
+}
+
+#[cfg(feature = "serde")]
+struct ArrayVecVisitor<A: Array>(PhantomData<A>);
+
+#[cfg(feature = "serde")]
+impl<'de, A: Array> Visitor<'de> for ArrayVecVisitor<A>
+where
+ A::Item: Deserialize<'de>,
+{
+ type Value = ArrayVec<A>;
+
+ fn expecting(
+ &self, formatter: &mut core::fmt::Formatter,
+ ) -> core::fmt::Result {
+ formatter.write_str("a sequence")
+ }
+
+ fn visit_seq<S>(self, mut seq: S) -> Result<Self::Value, S::Error>
+ where
+ S: SeqAccess<'de>,
+ {
+ let mut new_arrayvec: ArrayVec<A> = Default::default();
+
+ let mut idx = 0usize;
+ while let Some(value) = seq.next_element()? {
+ if new_arrayvec.len() >= new_arrayvec.capacity() {
+ return Err(DeserializeError::invalid_length(idx, &self));
+ }
+ new_arrayvec.push(value);
+ idx = idx + 1;
+ }
+
+ Ok(new_arrayvec)
+ }
+}
diff --git a/vendor/tinyvec/src/arrayvec_drain.rs b/vendor/tinyvec/src/arrayvec_drain.rs
new file mode 100644
index 000000000..44133ecd0
--- /dev/null
+++ b/vendor/tinyvec/src/arrayvec_drain.rs
@@ -0,0 +1,93 @@
+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> {
+ fn next_back(&mut self) -> Option<Self::Item> {
+ self.iter.next_back().map(take)
+ }
+
+ #[cfg(feature = "rustc_1_40")]
+ fn nth_back(&mut self, n: usize) -> Option<Self::Item> {
+ self.iter.nth_back(n).map(take)
+ }
+}
+
+impl<'a, T: 'a + Default> Iterator for ArrayVecDrain<'a, T> {
+ type Item = T;
+ fn next(&mut self) -> Option<Self::Item> {
+ self.iter.next().map(take)
+ }
+ fn size_hint(&self) -> (usize, Option<usize>) {
+ self.iter.size_hint()
+ }
+ fn nth(&mut self, n: usize) -> Option<Self::Item> {
+ self.iter.nth(n).map(take)
+ }
+ fn last(self) -> Option<Self::Item> {
+ self.iter.last().map(take)
+ }
+ fn for_each<F>(self, f: F)
+ where
+ F: FnMut(Self::Item),
+ {
+ self.iter.map(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! */
diff --git a/vendor/tinyvec/src/lib.rs b/vendor/tinyvec/src/lib.rs
new file mode 100644
index 000000000..87d96bb99
--- /dev/null
+++ b/vendor/tinyvec/src/lib.rs
@@ -0,0 +1,107 @@
+#![cfg_attr(not(feature = "std"), no_std)]
+#![forbid(unsafe_code)]
+#![cfg_attr(
+ feature = "nightly_slice_partition_dedup",
+ feature(slice_partition_dedup)
+)]
+#![cfg_attr(docs_rs, feature(doc_cfg))]
+#![warn(clippy::missing_inline_in_public_items)]
+#![warn(clippy::must_use_candidate)]
+#![warn(missing_docs)]
+
+//! `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.
+//! * `rustc_1_40` makes the crate assume a minimum rust version of `1.40.0`,
+//! which allows some better internal optimizations.
+//! * `serde` provides a `Serialize` and `Deserialize` 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`.
+//!
+//! ## Stability
+//! * The `1.0` series of the crate works with Rustc `1.34.0` or later, though
+//! you still need to have Rustc `1.36.0` to use the `alloc` feature.
+//! * The `2.0` version of the crate is planned for some time after the
+//! `min_const_generics` stuff becomes stable. This would greatly raise the
+//! minimum rust version and also allow us to totally eliminate the need for
+//! the `Array` trait. The actual usage of the crate is not expected to break
+//! significantly in this transition.
+
+#[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::*;
+
+// TODO MSRV(1.40.0): Just call the normal `core::mem::take`
+#[inline(always)]
+fn take<T: Default>(from: &mut T) -> T {
+ replace(from, T::default())
+}
diff --git a/vendor/tinyvec/src/slicevec.rs b/vendor/tinyvec/src/slicevec.rs
new file mode 100644
index 000000000..11664e1e9
--- /dev/null
+++ b/vendor/tinyvec/src/slicevec.rs
@@ -0,0 +1,1080 @@
+#![allow(unused_variables)]
+#![allow(missing_docs)]
+
+use super::*;
+
+/// A slice-backed vector-like data structure.
+///
+/// This is a very similar concept to `ArrayVec`, but instead
+/// of the backing memory being an owned array, the backing
+/// memory is a unique-borrowed slice. You can thus create
+/// one of these structures "around" some slice that you're
+/// working with to make it easier to manipulate.
+///
+/// * Has a fixed capacity (the initial slice size).
+/// * Has a variable length.
+pub struct SliceVec<'s, T> {
+ data: &'s mut [T],
+ len: usize,
+}
+
+impl<'s, T> Default for SliceVec<'s, T> {
+ #[inline(always)]
+ #[must_use]
+ fn default() -> Self {
+ Self { data: &mut [], len: 0 }
+ }
+}
+
+impl<'s, T> Deref for SliceVec<'s, T> {
+ type Target = [T];
+ #[inline(always)]
+ #[must_use]
+ fn deref(&self) -> &Self::Target {
+ &self.data[..self.len]
+ }
+}
+
+impl<'s, T> DerefMut for SliceVec<'s, T> {
+ #[inline(always)]
+ #[must_use]
+ fn deref_mut(&mut self) -> &mut Self::Target {
+ &mut self.data[..self.len]
+ }
+}
+
+impl<'s, T, I> Index<I> for SliceVec<'s, T>
+where
+ I: SliceIndex<[T]>,
+{
+ type Output = <I as SliceIndex<[T]>>::Output;
+ #[inline(always)]
+ #[must_use]
+ fn index(&self, index: I) -> &Self::Output {
+ &self.deref()[index]
+ }
+}
+
+impl<'s, T, I> IndexMut<I> for SliceVec<'s, T>
+where
+ I: SliceIndex<[T]>,
+{
+ #[inline(always)]
+ #[must_use]
+ fn index_mut(&mut self, index: I) -> &mut Self::Output {
+ &mut self.deref_mut()[index]
+ }
+}
+
+impl<'s, T> SliceVec<'s, T> {
+ #[inline]
+ pub fn append(&mut self, other: &mut Self)
+ where
+ T: Default,
+ {
+ for item in other.drain(..) {
+ self.push(item)
+ }
+ }
+
+ /// A `*mut` pointer to the backing slice.
+ ///
+ /// ## Safety
+ ///
+ /// This pointer has provenance over the _entire_ backing slice.
+ #[inline(always)]
+ #[must_use]
+ pub fn as_mut_ptr(&mut self) -> *mut T {
+ self.data.as_mut_ptr()
+ }
+
+ /// Performs a `deref_mut`, into unique slice form.
+ #[inline(always)]
+ #[must_use]
+ pub fn as_mut_slice(&mut self) -> &mut [T] {
+ self.deref_mut()
+ }
+
+ /// A `*const` pointer to the backing slice.
+ ///
+ /// ## Safety
+ ///
+ /// This pointer has provenance over the _entire_ backing slice.
+ #[inline(always)]
+ #[must_use]
+ pub fn as_ptr(&self) -> *const T {
+ self.data.as_ptr()
+ }
+
+ /// Performs a `deref`, into shared slice form.
+ #[inline(always)]
+ #[must_use]
+ pub fn as_slice(&self) -> &[T] {
+ self.deref()
+ }
+
+ /// The capacity of the `SliceVec`.
+ ///
+ /// This the length of the initial backing slice.
+ #[inline(always)]
+ #[must_use]
+ pub fn capacity(&self) -> usize {
+ self.data.len()
+ }
+
+ /// Truncates the `SliceVec` down to length 0.
+ #[inline(always)]
+ pub fn clear(&mut self)
+ where
+ T: Default,
+ {
+ self.truncate(0)
+ }
+
+ /// Creates a draining iterator that removes the specified range in the vector
+ /// and yields the removed items.
+ ///
+ /// ## Panics
+ /// * If the start is greater than the end
+ /// * If the end is past the edge of the vec.
+ ///
+ /// ## Example
+ /// ```rust
+ /// # use tinyvec::*;
+ /// let mut arr = [6, 7, 8];
+ /// let mut sv = SliceVec::from(&mut arr);
+ /// let drained_values: ArrayVec<[i32; 4]> = sv.drain(1..).collect();
+ /// assert_eq!(sv.as_slice(), &[6][..]);
+ /// assert_eq!(drained_values.as_slice(), &[7, 8][..]);
+ ///
+ /// sv.drain(..);
+ /// assert_eq!(sv.as_slice(), &[]);
+ /// ```
+ #[inline]
+ pub fn drain<'p, R: RangeBounds<usize>>(
+ &'p mut self, range: R,
+ ) -> SliceVecDrain<'p, 's, T>
+ where
+ T: Default,
+ {
+ use core::ops::Bound;
+ let start = match range.start_bound() {
+ Bound::Included(x) => *x,
+ Bound::Excluded(x) => x.saturating_add(1),
+ Bound::Unbounded => 0,
+ };
+ let end = match range.end_bound() {
+ Bound::Included(x) => x.saturating_add(1),
+ Bound::Excluded(x) => *x,
+ Bound::Unbounded => self.len,
+ };
+ assert!(
+ start <= end,
+ "SliceVec::drain> Illegal range, {} to {}",
+ start,
+ end
+ );
+ assert!(
+ end <= self.len,
+ "SliceVec::drain> Range ends at {} but length is only {}!",
+ end,
+ self.len
+ );
+ SliceVecDrain {
+ parent: self,
+ target_start: start,
+ target_index: start,
+ target_end: end,
+ }
+ }
+
+ #[inline]
+ pub fn extend_from_slice(&mut self, sli: &[T])
+ where
+ T: Clone,
+ {
+ if sli.is_empty() {
+ return;
+ }
+
+ let new_len = self.len + sli.len();
+ if new_len > self.capacity() {
+ panic!(
+ "SliceVec::extend_from_slice> total length {} exceeds capacity {}",
+ new_len,
+ self.capacity()
+ )
+ }
+
+ let target = &mut self.data[self.len..new_len];
+ target.clone_from_slice(sli);
+ self.set_len(new_len);
+ }
+
+ /// Fill the vector until its capacity has been reached.
+ ///
+ /// Successively fills unused space in the spare slice of the vector with
+ /// elements from the iterator. It then returns the remaining iterator
+ /// without exhausting it. This also allows appending the head of an
+ /// infinite iterator.
+ ///
+ /// This is an alternative to `Extend::extend` method for cases where the
+ /// length of the iterator can not be checked. Since this vector can not
+ /// reallocate to increase its capacity, it is unclear what to do with
+ /// remaining elements in the iterator and the iterator itself. The
+ /// interface also provides no way to communicate this to the caller.
+ ///
+ /// ## Panics
+ /// * If the `next` method of the provided iterator panics.
+ ///
+ /// ## Example
+ ///
+ /// ```rust
+ /// # use tinyvec::*;
+ /// let mut arr = [7, 7, 7, 7];
+ /// let mut sv = SliceVec::from_slice_len(&mut arr, 0);
+ /// let mut to_inf = sv.fill(0..);
+ /// assert_eq!(&sv[..], [0, 1, 2, 3]);
+ /// assert_eq!(to_inf.next(), Some(4));
+ /// ```
+ #[inline]
+ pub fn fill<I: IntoIterator<Item = T>>(&mut self, iter: I) -> I::IntoIter {
+ let mut iter = iter.into_iter();
+ for element in iter.by_ref().take(self.capacity() - self.len()) {
+ self.push(element);
+ }
+ iter
+ }
+
+ /// Wraps up a slice and uses the given length as the initial length.
+ ///
+ /// If you want to simply use the full slice, use `from` instead.
+ ///
+ /// ## Panics
+ ///
+ /// * The length specified must be less than or equal to the capacity of the
+ /// slice.
+ #[inline]
+ #[must_use]
+ #[allow(clippy::match_wild_err_arm)]
+ pub fn from_slice_len(data: &'s mut [T], len: usize) -> Self {
+ assert!(len <= data.len());
+ Self { data, len }
+ }
+
+ /// Inserts an item at the position given, moving all following elements +1
+ /// index.
+ ///
+ /// ## Panics
+ /// * If `index` > `len`
+ /// * If the capacity is exhausted
+ ///
+ /// ## Example
+ /// ```rust
+ /// # use tinyvec::*;
+ /// let mut arr = [1, 2, 3, 0, 0];
+ /// let mut sv = SliceVec::from_slice_len(&mut arr, 3);
+ /// sv.insert(1, 4);
+ /// assert_eq!(sv.as_slice(), &[1, 4, 2, 3]);
+ /// sv.insert(4, 5);
+ /// assert_eq!(sv.as_slice(), &[1, 4, 2, 3, 5]);
+ /// ```
+ #[inline]
+ pub fn insert(&mut self, index: usize, item: T) {
+ if index > self.len {
+ panic!("SliceVec::insert> index {} is out of bounds {}", index, self.len);
+ }
+
+ // Try to push the element.
+ self.push(item);
+ // And move it into its place.
+ self.as_mut_slice()[index..].rotate_right(1);
+ }
+
+ /// Checks if the length is 0.
+ #[inline(always)]
+ #[must_use]
+ pub fn is_empty(&self) -> bool {
+ self.len == 0
+ }
+
+ /// The length of the `SliceVec` (in elements).
+ #[inline(always)]
+ #[must_use]
+ pub fn len(&self) -> usize {
+ self.len
+ }
+
+ /// Remove and return the last element of the vec, if there is one.
+ ///
+ /// ## Failure
+ /// * If the vec is empty you get `None`.
+ ///
+ /// ## Example
+ /// ```rust
+ /// # use tinyvec::*;
+ /// let mut arr = [1, 2];
+ /// let mut sv = SliceVec::from(&mut arr);
+ /// assert_eq!(sv.pop(), Some(2));
+ /// assert_eq!(sv.pop(), Some(1));
+ /// assert_eq!(sv.pop(), None);
+ /// ```
+ #[inline]
+ pub fn pop(&mut self) -> Option<T>
+ where
+ T: Default,
+ {
+ if self.len > 0 {
+ self.len -= 1;
+ let out = take(&mut self.data[self.len]);
+ Some(out)
+ } else {
+ None
+ }
+ }
+
+ /// Place an element onto the end of the vec.
+ ///
+ /// ## Panics
+ /// * If the length of the vec would overflow the capacity.
+ ///
+ /// ## Example
+ /// ```rust
+ /// # use tinyvec::*;
+ /// let mut arr = [0, 0];
+ /// let mut sv = SliceVec::from_slice_len(&mut arr, 0);
+ /// assert_eq!(&sv[..], []);
+ /// sv.push(1);
+ /// assert_eq!(&sv[..], [1]);
+ /// sv.push(2);
+ /// assert_eq!(&sv[..], [1, 2]);
+ /// // sv.push(3); this would overflow the ArrayVec and panic!
+ /// ```
+ #[inline(always)]
+ pub fn push(&mut self, val: T) {
+ if self.len < self.capacity() {
+ self.data[self.len] = val;
+ self.len += 1;
+ } else {
+ panic!("SliceVec::push> capacity overflow")
+ }
+ }
+
+ /// Removes the item at `index`, shifting all others down by one index.
+ ///
+ /// Returns the removed element.
+ ///
+ /// ## Panics
+ ///
+ /// * If the index is out of bounds.
+ ///
+ /// ## Example
+ ///
+ /// ```rust
+ /// # use tinyvec::*;
+ /// let mut arr = [1, 2, 3];
+ /// let mut sv = SliceVec::from(&mut arr);
+ /// assert_eq!(sv.remove(1), 2);
+ /// assert_eq!(&sv[..], [1, 3]);
+ /// ```
+ #[inline]
+ pub fn remove(&mut self, index: usize) -> T
+ where
+ T: Default,
+ {
+ let targets: &mut [T] = &mut self.deref_mut()[index..];
+ let item = take(&mut targets[0]);
+ targets.rotate_left(1);
+ self.len -= 1;
+ item
+ }
+
+ /// As [`resize_with`](SliceVec::resize_with)
+ /// and it clones the value as the closure.
+ ///
+ /// ## Example
+ ///
+ /// ```rust
+ /// # use tinyvec::*;
+ /// // bigger
+ /// let mut arr = ["hello", "", "", "", ""];
+ /// let mut sv = SliceVec::from_slice_len(&mut arr, 1);
+ /// sv.resize(3, "world");
+ /// assert_eq!(&sv[..], ["hello", "world", "world"]);
+ ///
+ /// // smaller
+ /// let mut arr = ['a', 'b', 'c', 'd'];
+ /// let mut sv = SliceVec::from(&mut arr);
+ /// sv.resize(2, 'z');
+ /// assert_eq!(&sv[..], ['a', 'b']);
+ /// ```
+ #[inline]
+ pub fn resize(&mut self, new_len: usize, new_val: T)
+ where
+ T: Clone,
+ {
+ self.resize_with(new_len, || new_val.clone())
+ }
+
+ /// Resize the vec to the new length.
+ ///
+ /// * If it needs to be longer, it's filled with repeated calls to the
+ /// provided function.
+ /// * If it needs to be shorter, it's truncated.
+ /// * If the type needs to drop the truncated slots are filled with calls to
+ /// the provided function.
+ ///
+ /// ## Example
+ ///
+ /// ```rust
+ /// # use tinyvec::*;
+ /// let mut arr = [1, 2, 3, 7, 7, 7, 7];
+ /// let mut sv = SliceVec::from_slice_len(&mut arr, 3);
+ /// sv.resize_with(5, Default::default);
+ /// assert_eq!(&sv[..], [1, 2, 3, 0, 0]);
+ ///
+ /// let mut arr = [0, 0, 0, 0];
+ /// let mut sv = SliceVec::from_slice_len(&mut arr, 0);
+ /// let mut p = 1;
+ /// sv.resize_with(4, || {
+ /// p *= 2;
+ /// p
+ /// });
+ /// assert_eq!(&sv[..], [2, 4, 8, 16]);
+ /// ```
+ #[inline]
+ pub fn resize_with<F: FnMut() -> T>(&mut self, new_len: usize, mut f: F) {
+ match new_len.checked_sub(self.len) {
+ None => {
+ if needs_drop::<T>() {
+ while self.len() > new_len {
+ self.len -= 1;
+ self.data[self.len] = f();
+ }
+ } else {
+ self.len = new_len;
+ }
+ }
+ Some(new_elements) => {
+ for _ in 0..new_elements {
+ self.push(f());
+ }
+ }
+ }
+ }
+
+ /// Walk the vec and keep only the elements that pass the predicate given.
+ ///
+ /// ## Example
+ ///
+ /// ```rust
+ /// # use tinyvec::*;
+ ///
+ /// let mut arr = [1, 1, 2, 3, 3, 4];
+ /// let mut sv = SliceVec::from(&mut arr);
+ /// sv.retain(|&x| x % 2 == 0);
+ /// assert_eq!(&sv[..], [2, 4]);
+ /// ```
+ #[inline]
+ pub fn retain<F: FnMut(&T) -> bool>(&mut self, mut acceptable: F)
+ where
+ T: Default,
+ {
+ // Drop guard to contain exactly the remaining elements when the test
+ // panics.
+ struct JoinOnDrop<'vec, Item> {
+ items: &'vec mut [Item],
+ done_end: usize,
+ // Start of tail relative to `done_end`.
+ tail_start: usize,
+ }
+
+ impl<Item> Drop for JoinOnDrop<'_, Item> {
+ fn drop(&mut self) {
+ self.items[self.done_end..].rotate_left(self.tail_start);
+ }
+ }
+
+ let mut rest = JoinOnDrop { items: self.data, done_end: 0, tail_start: 0 };
+
+ for idx in 0..self.len {
+ // Loop start invariant: idx = rest.done_end + rest.tail_start
+ if !acceptable(&rest.items[idx]) {
+ let _ = take(&mut rest.items[idx]);
+ self.len -= 1;
+ rest.tail_start += 1;
+ } else {
+ rest.items.swap(rest.done_end, idx);
+ rest.done_end += 1;
+ }
+ }
+ }
+
+ /// Forces the length of the vector to `new_len`.
+ ///
+ /// ## Panics
+ /// * If `new_len` is greater than the vec's capacity.
+ ///
+ /// ## Safety
+ /// * This is a fully safe operation! The inactive memory already counts as
+ /// "initialized" by Rust's rules.
+ /// * Other than "the memory is initialized" there are no other guarantees
+ /// regarding what you find in the inactive portion of the vec.
+ #[inline(always)]
+ pub fn set_len(&mut self, new_len: usize) {
+ if new_len > self.capacity() {
+ // Note(Lokathor): Technically we don't have to panic here, and we could
+ // just let some other call later on trigger a panic on accident when the
+ // length is wrong. However, it's a lot easier to catch bugs when things
+ // are more "fail-fast".
+ panic!(
+ "SliceVec::set_len> new length {} exceeds capacity {}",
+ new_len,
+ self.capacity()
+ )
+ } else {
+ self.len = new_len;
+ }
+ }
+
+ /// Splits the collection at the point given.
+ ///
+ /// * `[0, at)` stays in this vec (and this vec is now full).
+ /// * `[at, len)` ends up in the new vec (with any spare capacity).
+ ///
+ /// ## Panics
+ /// * if `at` > `self.len()`
+ ///
+ /// ## Example
+ ///
+ /// ```rust
+ /// # use tinyvec::*;
+ /// let mut arr = [1, 2, 3];
+ /// let mut sv = SliceVec::from(&mut arr);
+ /// let sv2 = sv.split_off(1);
+ /// assert_eq!(&sv[..], [1]);
+ /// assert_eq!(&sv2[..], [2, 3]);
+ /// ```
+ #[inline]
+ pub fn split_off<'a>(&'a mut self, at: usize) -> SliceVec<'s, T> {
+ let mut new = Self::default();
+ let backing: &'s mut [T] = replace(&mut self.data, &mut []);
+ let (me, other) = backing.split_at_mut(at);
+ new.len = self.len - at;
+ new.data = other;
+ self.len = me.len();
+ self.data = me;
+ new
+ }
+
+ /// Remove an element, swapping the end of the vec into its place.
+ ///
+ /// ## Panics
+ /// * If the index is out of bounds.
+ ///
+ /// ## Example
+ /// ```rust
+ /// # use tinyvec::*;
+ /// let mut arr = ["foo", "bar", "quack", "zap"];
+ /// let mut sv = SliceVec::from(&mut arr);
+ ///
+ /// assert_eq!(sv.swap_remove(1), "bar");
+ /// assert_eq!(&sv[..], ["foo", "zap", "quack"]);
+ ///
+ /// assert_eq!(sv.swap_remove(0), "foo");
+ /// assert_eq!(&sv[..], ["quack", "zap"]);
+ /// ```
+ #[inline]
+ pub fn swap_remove(&mut self, index: usize) -> T
+ where
+ T: Default,
+ {
+ assert!(
+ index < self.len,
+ "SliceVec::swap_remove> index {} is out of bounds {}",
+ index,
+ self.len
+ );
+ if index == self.len - 1 {
+ self.pop().unwrap()
+ } else {
+ let i = self.pop().unwrap();
+ replace(&mut self[index], i)
+ }
+ }
+
+ /// Reduces the vec's length to the given value.
+ ///
+ /// If the vec is already shorter than the input, nothing happens.
+ #[inline]
+ pub fn truncate(&mut self, new_len: usize)
+ where
+ T: Default,
+ {
+ if needs_drop::<T>() {
+ while self.len > new_len {
+ self.pop();
+ }
+ } else {
+ self.len = self.len.min(new_len);
+ }
+ }
+
+ /// Wraps a slice, using the given length as the starting length.
+ ///
+ /// If you want to use the whole length of the slice, you can just use the
+ /// `From` impl.
+ ///
+ /// ## Failure
+ ///
+ /// If the given length is greater than the length of the slice you get
+ /// `None`.
+ #[inline]
+ pub fn try_from_slice_len(data: &'s mut [T], len: usize) -> Option<Self> {
+ if len <= data.len() {
+ Some(Self { data, len })
+ } else {
+ None
+ }
+ }
+}
+
+#[cfg(feature = "grab_spare_slice")]
+impl<'s, T> SliceVec<'s, T> {
+ /// Obtain the shared slice of the array _after_ the active memory.
+ ///
+ /// ## Example
+ /// ```rust
+ /// # use tinyvec::*;
+ /// let mut arr = [0; 4];
+ /// let mut sv = SliceVec::from_slice_len(&mut arr, 0);
+ /// assert_eq!(sv.grab_spare_slice().len(), 4);
+ /// sv.push(10);
+ /// sv.push(11);
+ /// sv.push(12);
+ /// sv.push(13);
+ /// assert_eq!(sv.grab_spare_slice().len(), 0);
+ /// ```
+ #[inline(always)]
+ pub fn grab_spare_slice(&self) -> &[T] {
+ &self.data[self.len..]
+ }
+
+ /// Obtain the mutable slice of the array _after_ the active memory.
+ ///
+ /// ## Example
+ /// ```rust
+ /// # use tinyvec::*;
+ /// let mut arr = [0; 4];
+ /// let mut sv = SliceVec::from_slice_len(&mut arr, 0);
+ /// assert_eq!(sv.grab_spare_slice_mut().len(), 4);
+ /// sv.push(10);
+ /// sv.push(11);
+ /// assert_eq!(sv.grab_spare_slice_mut().len(), 2);
+ /// ```
+ #[inline(always)]
+ pub fn grab_spare_slice_mut(&mut self) -> &mut [T] {
+ &mut self.data[self.len..]
+ }
+}
+
+impl<'s, T> From<&'s mut [T]> for SliceVec<'s, T> {
+ /// Uses the full slice as the initial length.
+ /// ## Example
+ /// ```rust
+ /// # use tinyvec::*;
+ /// let mut arr = [0_i32; 2];
+ /// let mut sv = SliceVec::from(&mut arr[..]);
+ /// ```
+ fn from(data: &'s mut [T]) -> Self {
+ let len = data.len();
+ Self { data, len }
+ }
+}
+
+impl<'s, T, A> From<&'s mut A> for SliceVec<'s, T>
+where
+ A: AsMut<[T]>,
+{
+ /// Calls `AsRef::as_mut` then uses the full slice as the initial length.
+ /// ## Example
+ /// ```rust
+ /// # use tinyvec::*;
+ /// let mut arr = [0, 0];
+ /// let mut sv = SliceVec::from(&mut arr);
+ /// ```
+ fn from(a: &'s mut A) -> Self {
+ let data = a.as_mut();
+ let len = data.len();
+ Self { data, len }
+ }
+}
+
+/// Draining iterator for [`SliceVec`]
+///
+/// See [`SliceVec::drain`](SliceVec::drain)
+pub struct SliceVecDrain<'p, 's, T: Default> {
+ parent: &'p mut SliceVec<'s, T>,
+ target_start: usize,
+ target_index: usize,
+ target_end: usize,
+}
+impl<'p, 's, T: Default> Iterator for SliceVecDrain<'p, 's, T> {
+ type Item = T;
+ #[inline]
+ fn next(&mut self) -> Option<Self::Item> {
+ if self.target_index != self.target_end {
+ let out = take(&mut self.parent[self.target_index]);
+ self.target_index += 1;
+ Some(out)
+ } else {
+ None
+ }
+ }
+}
+impl<'p, 's, T: Default> FusedIterator for SliceVecDrain<'p, 's, T> {}
+impl<'p, 's, T: Default> Drop for SliceVecDrain<'p, 's, T> {
+ #[inline]
+ fn drop(&mut self) {
+ // Changed because it was moving `self`, it's also more clear and the std
+ // does the same
+ self.for_each(drop);
+ // Implementation very similar to [`SliceVec::remove`](SliceVec::remove)
+ let count = self.target_end - self.target_start;
+ let targets: &mut [T] = &mut self.parent.deref_mut()[self.target_start..];
+ targets.rotate_left(count);
+ self.parent.len -= count;
+ }
+}
+
+impl<'s, T> AsMut<[T]> for SliceVec<'s, T> {
+ #[inline(always)]
+ #[must_use]
+ fn as_mut(&mut self) -> &mut [T] {
+ &mut *self
+ }
+}
+
+impl<'s, T> AsRef<[T]> for SliceVec<'s, T> {
+ #[inline(always)]
+ #[must_use]
+ fn as_ref(&self) -> &[T] {
+ &*self
+ }
+}
+
+impl<'s, T> Borrow<[T]> for SliceVec<'s, T> {
+ #[inline(always)]
+ #[must_use]
+ fn borrow(&self) -> &[T] {
+ &*self
+ }
+}
+
+impl<'s, T> BorrowMut<[T]> for SliceVec<'s, T> {
+ #[inline(always)]
+ #[must_use]
+ fn borrow_mut(&mut self) -> &mut [T] {
+ &mut *self
+ }
+}
+
+impl<'s, T> Extend<T> for SliceVec<'s, T> {
+ #[inline]
+ fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I) {
+ for t in iter {
+ self.push(t)
+ }
+ }
+}
+
+impl<'s, T> IntoIterator for SliceVec<'s, T> {
+ type Item = &'s mut T;
+ type IntoIter = core::slice::IterMut<'s, T>;
+ #[inline(always)]
+ #[must_use]
+ fn into_iter(self) -> Self::IntoIter {
+ self.data.iter_mut()
+ }
+}
+
+impl<'s, T> PartialEq for SliceVec<'s, T>
+where
+ T: PartialEq,
+{
+ #[inline]
+ #[must_use]
+ fn eq(&self, other: &Self) -> bool {
+ self.as_slice().eq(other.as_slice())
+ }
+}
+impl<'s, T> Eq for SliceVec<'s, T> where T: Eq {}
+
+impl<'s, T> PartialOrd for SliceVec<'s, T>
+where
+ T: PartialOrd,
+{
+ #[inline]
+ #[must_use]
+ fn partial_cmp(&self, other: &Self) -> Option<core::cmp::Ordering> {
+ self.as_slice().partial_cmp(other.as_slice())
+ }
+}
+impl<'s, T> Ord for SliceVec<'s, T>
+where
+ T: Ord,
+{
+ #[inline]
+ #[must_use]
+ fn cmp(&self, other: &Self) -> core::cmp::Ordering {
+ self.as_slice().cmp(other.as_slice())
+ }
+}
+
+impl<'s, T> PartialEq<&[T]> for SliceVec<'s, T>
+where
+ T: PartialEq,
+{
+ #[inline]
+ #[must_use]
+ fn eq(&self, other: &&[T]) -> bool {
+ self.as_slice().eq(*other)
+ }
+}
+
+impl<'s, T> Hash for SliceVec<'s, T>
+where
+ T: Hash,
+{
+ #[inline]
+ fn hash<H: Hasher>(&self, state: &mut H) {
+ self.as_slice().hash(state)
+ }
+}
+
+#[cfg(feature = "experimental_write_impl")]
+impl<'s> core::fmt::Write for SliceVec<'s, u8> {
+ fn write_str(&mut self, s: &str) -> core::fmt::Result {
+ let my_len = self.len();
+ let str_len = s.as_bytes().len();
+ if my_len + str_len <= self.capacity() {
+ let remainder = &mut self.data[my_len..];
+ let target = &mut remainder[..str_len];
+ target.copy_from_slice(s.as_bytes());
+ Ok(())
+ } else {
+ Err(core::fmt::Error)
+ }
+ }
+}
+
+// // // // // // // //
+// Formatting impls
+// // // // // // // //
+
+impl<'s, T> Binary for SliceVec<'s, T>
+where
+ T: Binary,
+{
+ #[allow(clippy::missing_inline_in_public_items)]
+ fn fmt(&self, f: &mut Formatter) -> core::fmt::Result {
+ write!(f, "[")?;
+ if f.alternate() {
+ write!(f, "\n ")?;
+ }
+ for (i, elem) in self.iter().enumerate() {
+ if i > 0 {
+ write!(f, ",{}", if f.alternate() { "\n " } else { " " })?;
+ }
+ Binary::fmt(elem, f)?;
+ }
+ if f.alternate() {
+ write!(f, ",\n")?;
+ }
+ write!(f, "]")
+ }
+}
+
+impl<'s, T> Debug for SliceVec<'s, T>
+where
+ T: Debug,
+{
+ #[allow(clippy::missing_inline_in_public_items)]
+ fn fmt(&self, f: &mut Formatter) -> core::fmt::Result {
+ write!(f, "[")?;
+ if f.alternate() {
+ write!(f, "\n ")?;
+ }
+ for (i, elem) in self.iter().enumerate() {
+ if i > 0 {
+ write!(f, ",{}", if f.alternate() { "\n " } else { " " })?;
+ }
+ Debug::fmt(elem, f)?;
+ }
+ if f.alternate() {
+ write!(f, ",\n")?;
+ }
+ write!(f, "]")
+ }
+}
+
+impl<'s, T> Display for SliceVec<'s, T>
+where
+ T: Display,
+{
+ #[allow(clippy::missing_inline_in_public_items)]
+ fn fmt(&self, f: &mut Formatter) -> core::fmt::Result {
+ write!(f, "[")?;
+ if f.alternate() {
+ write!(f, "\n ")?;
+ }
+ for (i, elem) in self.iter().enumerate() {
+ if i > 0 {
+ write!(f, ",{}", if f.alternate() { "\n " } else { " " })?;
+ }
+ Display::fmt(elem, f)?;
+ }
+ if f.alternate() {
+ write!(f, ",\n")?;
+ }
+ write!(f, "]")
+ }
+}
+
+impl<'s, T> LowerExp for SliceVec<'s, T>
+where
+ T: LowerExp,
+{
+ #[allow(clippy::missing_inline_in_public_items)]
+ fn fmt(&self, f: &mut Formatter) -> core::fmt::Result {
+ write!(f, "[")?;
+ if f.alternate() {
+ write!(f, "\n ")?;
+ }
+ for (i, elem) in self.iter().enumerate() {
+ if i > 0 {
+ write!(f, ",{}", if f.alternate() { "\n " } else { " " })?;
+ }
+ LowerExp::fmt(elem, f)?;
+ }
+ if f.alternate() {
+ write!(f, ",\n")?;
+ }
+ write!(f, "]")
+ }
+}
+
+impl<'s, T> LowerHex for SliceVec<'s, T>
+where
+ T: LowerHex,
+{
+ #[allow(clippy::missing_inline_in_public_items)]
+ fn fmt(&self, f: &mut Formatter) -> core::fmt::Result {
+ write!(f, "[")?;
+ if f.alternate() {
+ write!(f, "\n ")?;
+ }
+ for (i, elem) in self.iter().enumerate() {
+ if i > 0 {
+ write!(f, ",{}", if f.alternate() { "\n " } else { " " })?;
+ }
+ LowerHex::fmt(elem, f)?;
+ }
+ if f.alternate() {
+ write!(f, ",\n")?;
+ }
+ write!(f, "]")
+ }
+}
+
+impl<'s, T> Octal for SliceVec<'s, T>
+where
+ T: Octal,
+{
+ #[allow(clippy::missing_inline_in_public_items)]
+ fn fmt(&self, f: &mut Formatter) -> core::fmt::Result {
+ write!(f, "[")?;
+ if f.alternate() {
+ write!(f, "\n ")?;
+ }
+ for (i, elem) in self.iter().enumerate() {
+ if i > 0 {
+ write!(f, ",{}", if f.alternate() { "\n " } else { " " })?;
+ }
+ Octal::fmt(elem, f)?;
+ }
+ if f.alternate() {
+ write!(f, ",\n")?;
+ }
+ write!(f, "]")
+ }
+}
+
+impl<'s, T> Pointer for SliceVec<'s, T>
+where
+ T: Pointer,
+{
+ #[allow(clippy::missing_inline_in_public_items)]
+ fn fmt(&self, f: &mut Formatter) -> core::fmt::Result {
+ write!(f, "[")?;
+ if f.alternate() {
+ write!(f, "\n ")?;
+ }
+ for (i, elem) in self.iter().enumerate() {
+ if i > 0 {
+ write!(f, ",{}", if f.alternate() { "\n " } else { " " })?;
+ }
+ Pointer::fmt(elem, f)?;
+ }
+ if f.alternate() {
+ write!(f, ",\n")?;
+ }
+ write!(f, "]")
+ }
+}
+
+impl<'s, T> UpperExp for SliceVec<'s, T>
+where
+ T: UpperExp,
+{
+ #[allow(clippy::missing_inline_in_public_items)]
+ fn fmt(&self, f: &mut Formatter) -> core::fmt::Result {
+ write!(f, "[")?;
+ if f.alternate() {
+ write!(f, "\n ")?;
+ }
+ for (i, elem) in self.iter().enumerate() {
+ if i > 0 {
+ write!(f, ",{}", if f.alternate() { "\n " } else { " " })?;
+ }
+ UpperExp::fmt(elem, f)?;
+ }
+ if f.alternate() {
+ write!(f, ",\n")?;
+ }
+ write!(f, "]")
+ }
+}
+
+impl<'s, T> UpperHex for SliceVec<'s, T>
+where
+ T: UpperHex,
+{
+ #[allow(clippy::missing_inline_in_public_items)]
+ fn fmt(&self, f: &mut Formatter) -> core::fmt::Result {
+ write!(f, "[")?;
+ if f.alternate() {
+ write!(f, "\n ")?;
+ }
+ for (i, elem) in self.iter().enumerate() {
+ if i > 0 {
+ write!(f, ",{}", if f.alternate() { "\n " } else { " " })?;
+ }
+ UpperHex::fmt(elem, f)?;
+ }
+ if f.alternate() {
+ write!(f, ",\n")?;
+ }
+ write!(f, "]")
+ }
+}
diff --git a/vendor/tinyvec/src/tinyvec.rs b/vendor/tinyvec/src/tinyvec.rs
new file mode 100644
index 000000000..a5e1c1551
--- /dev/null
+++ b/vendor/tinyvec/src/tinyvec.rs
@@ -0,0 +1,1740 @@
+#![cfg(feature = "alloc")]
+
+use super::*;
+
+use alloc::vec::{self, Vec};
+use core::convert::TryFrom;
+use tinyvec_macros::impl_mirrored;
+
+#[cfg(feature = "rustc_1_57")]
+use alloc::collections::TryReserveError;
+
+#[cfg(feature = "serde")]
+use core::marker::PhantomData;
+#[cfg(feature = "serde")]
+use serde::de::{Deserialize, Deserializer, SeqAccess, Visitor};
+#[cfg(feature = "serde")]
+use serde::ser::{Serialize, SerializeSeq, Serializer};
+
+/// Helper to make a `TinyVec`.
+///
+/// You specify the backing array type, and optionally give all the elements you
+/// want to initially place into the array.
+///
+/// ```rust
+/// use tinyvec::*;
+///
+/// // The backing array type can be specified in the macro call
+/// let empty_tv = tiny_vec!([u8; 16]);
+/// let some_ints = tiny_vec!([i32; 4] => 1, 2, 3);
+/// let many_ints = tiny_vec!([i32; 4] => 1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
+///
+/// // Or left to inference
+/// let empty_tv: TinyVec<[u8; 16]> = tiny_vec!();
+/// let some_ints: TinyVec<[i32; 4]> = tiny_vec!(1, 2, 3);
+/// let many_ints: TinyVec<[i32; 4]> = tiny_vec!(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
+/// ```
+#[macro_export]
+#[cfg_attr(docs_rs, doc(cfg(feature = "alloc")))]
+macro_rules! tiny_vec {
+ ($array_type:ty => $($elem:expr),* $(,)?) => {
+ {
+ // https://github.com/rust-lang/lang-team/issues/28
+ const INVOKED_ELEM_COUNT: usize = 0 $( + { let _ = stringify!($elem); 1 })*;
+ // If we have more `$elem` than the `CAPACITY` we will simply go directly
+ // to constructing on the heap.
+ match $crate::TinyVec::constructor_for_capacity(INVOKED_ELEM_COUNT) {
+ $crate::TinyVecConstructor::Inline(f) => {
+ f($crate::array_vec!($array_type => $($elem),*))
+ }
+ $crate::TinyVecConstructor::Heap(f) => {
+ f(vec!($($elem),*))
+ }
+ }
+ }
+ };
+ ($array_type:ty) => {
+ $crate::TinyVec::<$array_type>::default()
+ };
+ ($($elem:expr),*) => {
+ $crate::tiny_vec!(_ => $($elem),*)
+ };
+ ($elem:expr; $n:expr) => {
+ $crate::TinyVec::from([$elem; $n])
+ };
+ () => {
+ $crate::tiny_vec!(_)
+ };
+}
+
+#[doc(hidden)] // Internal implementation details of `tiny_vec!`
+pub enum TinyVecConstructor<A: Array> {
+ Inline(fn(ArrayVec<A>) -> TinyVec<A>),
+ Heap(fn(Vec<A::Item>) -> TinyVec<A>),
+}
+
+/// A vector that starts inline, but can automatically move to the heap.
+///
+/// * Requires the `alloc` feature
+///
+/// A `TinyVec` is either an Inline([`ArrayVec`](crate::ArrayVec::<A>)) or
+/// Heap([`Vec`](https://doc.rust-lang.org/alloc/vec/struct.Vec.html)). The
+/// interface for the type as a whole is a bunch of methods that just match on
+/// the enum variant and then call the same method on the inner vec.
+///
+/// ## Construction
+///
+/// Because it's an enum, you can construct a `TinyVec` simply by making an
+/// `ArrayVec` or `Vec` and then putting it into the enum.
+///
+/// There is also a macro
+///
+/// ```rust
+/// # use tinyvec::*;
+/// let empty_tv = tiny_vec!([u8; 16]);
+/// let some_ints = tiny_vec!([i32; 4] => 1, 2, 3);
+/// ```
+#[cfg_attr(docs_rs, doc(cfg(feature = "alloc")))]
+pub enum TinyVec<A: Array> {
+ #[allow(missing_docs)]
+ Inline(ArrayVec<A>),
+ #[allow(missing_docs)]
+ Heap(Vec<A::Item>),
+}
+
+impl<A> Clone for TinyVec<A>
+where
+ A: Array + Clone,
+ A::Item: Clone,
+{
+ #[inline]
+ fn clone(&self) -> Self {
+ match self {
+ TinyVec::Heap(v) => TinyVec::Heap(v.clone()),
+ TinyVec::Inline(v) => TinyVec::Inline(v.clone()),
+ }
+ }
+
+ #[inline]
+ fn clone_from(&mut self, o: &Self) {
+ if o.len() > self.len() {
+ self.reserve(o.len() - self.len());
+ } else {
+ self.truncate(o.len());
+ }
+ let (start, end) = o.split_at(self.len());
+ for (dst, src) in self.iter_mut().zip(start) {
+ dst.clone_from(src);
+ }
+ self.extend_from_slice(end);
+ }
+}
+
+impl<A: Array> Default for TinyVec<A> {
+ #[inline]
+ #[must_use]
+ fn default() -> Self {
+ TinyVec::Inline(ArrayVec::default())
+ }
+}
+
+impl<A: Array> Deref for TinyVec<A> {
+ type Target = [A::Item];
+
+ impl_mirrored! {
+ type Mirror = TinyVec;
+ #[inline(always)]
+ #[must_use]
+ fn deref(self: &Self) -> &Self::Target;
+ }
+}
+
+impl<A: Array> DerefMut for TinyVec<A> {
+ impl_mirrored! {
+ type Mirror = TinyVec;
+ #[inline(always)]
+ #[must_use]
+ fn deref_mut(self: &mut Self) -> &mut Self::Target;
+ }
+}
+
+impl<A: Array, I: SliceIndex<[A::Item]>> Index<I> for TinyVec<A> {
+ type Output = <I as SliceIndex<[A::Item]>>::Output;
+ #[inline(always)]
+ #[must_use]
+ fn index(&self, index: I) -> &Self::Output {
+ &self.deref()[index]
+ }
+}
+
+impl<A: Array, I: SliceIndex<[A::Item]>> IndexMut<I> for TinyVec<A> {
+ #[inline(always)]
+ #[must_use]
+ fn index_mut(&mut self, index: I) -> &mut Self::Output {
+ &mut self.deref_mut()[index]
+ }
+}
+
+#[cfg(feature = "std")]
+#[cfg_attr(docs_rs, doc(cfg(feature = "std")))]
+impl<A: Array<Item = u8>> std::io::Write for TinyVec<A> {
+ #[inline(always)]
+ fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> {
+ self.extend_from_slice(buf);
+ Ok(buf.len())
+ }
+
+ #[inline(always)]
+ fn flush(&mut self) -> std::io::Result<()> {
+ Ok(())
+ }
+}
+
+#[cfg(feature = "serde")]
+#[cfg_attr(docs_rs, doc(cfg(feature = "serde")))]
+impl<A: Array> Serialize for TinyVec<A>
+where
+ A::Item: Serialize,
+{
+ #[must_use]
+ fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
+ where
+ S: Serializer,
+ {
+ let mut seq = serializer.serialize_seq(Some(self.len()))?;
+ for element in self.iter() {
+ seq.serialize_element(element)?;
+ }
+ seq.end()
+ }
+}
+
+#[cfg(feature = "serde")]
+#[cfg_attr(docs_rs, doc(cfg(feature = "serde")))]
+impl<'de, A: Array> Deserialize<'de> for TinyVec<A>
+where
+ A::Item: Deserialize<'de>,
+{
+ fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
+ where
+ D: Deserializer<'de>,
+ {
+ deserializer.deserialize_seq(TinyVecVisitor(PhantomData))
+ }
+}
+
+#[cfg(feature = "arbitrary")]
+#[cfg_attr(docs_rs, doc(cfg(feature = "arbitrary")))]
+impl<'a, A> arbitrary::Arbitrary<'a> for TinyVec<A>
+where
+ A: Array,
+ A::Item: arbitrary::Arbitrary<'a>,
+{
+ fn arbitrary(u: &mut arbitrary::Unstructured<'a>) -> arbitrary::Result<Self> {
+ let v = Vec::arbitrary(u)?;
+ let mut tv = TinyVec::Heap(v);
+ tv.shrink_to_fit();
+ Ok(tv)
+ }
+}
+
+impl<A: Array> TinyVec<A> {
+ /// Returns whether elements are on heap
+ #[inline(always)]
+ #[must_use]
+ pub fn is_heap(&self) -> bool {
+ match self {
+ TinyVec::Heap(_) => true,
+ TinyVec::Inline(_) => false,
+ }
+ }
+ /// Returns whether elements are on stack
+ #[inline(always)]
+ #[must_use]
+ pub fn is_inline(&self) -> bool {
+ !self.is_heap()
+ }
+
+ /// Shrinks the capacity of the vector as much as possible.\
+ /// It is inlined if length is less than `A::CAPACITY`.
+ /// ```rust
+ /// use tinyvec::*;
+ /// let mut tv = tiny_vec!([i32; 2] => 1, 2, 3);
+ /// assert!(tv.is_heap());
+ /// let _ = tv.pop();
+ /// assert!(tv.is_heap());
+ /// tv.shrink_to_fit();
+ /// assert!(tv.is_inline());
+ /// ```
+ pub fn shrink_to_fit(&mut self) {
+ let vec = match self {
+ TinyVec::Inline(_) => return,
+ TinyVec::Heap(h) => h,
+ };
+
+ if vec.len() > A::CAPACITY {
+ return vec.shrink_to_fit();
+ }
+
+ let moved_vec = core::mem::replace(vec, Vec::new());
+
+ let mut av = ArrayVec::default();
+ let mut rest = av.fill(moved_vec);
+ debug_assert!(rest.next().is_none());
+ *self = TinyVec::Inline(av);
+ }
+
+ /// Moves the content of the TinyVec to the heap, if it's inline.
+ /// ```rust
+ /// use tinyvec::*;
+ /// let mut tv = tiny_vec!([i32; 4] => 1, 2, 3);
+ /// assert!(tv.is_inline());
+ /// tv.move_to_the_heap();
+ /// assert!(tv.is_heap());
+ /// ```
+ #[allow(clippy::missing_inline_in_public_items)]
+ pub fn move_to_the_heap(&mut self) {
+ let arr = match self {
+ TinyVec::Heap(_) => return,
+ TinyVec::Inline(a) => a,
+ };
+
+ let v = arr.drain_to_vec();
+ *self = TinyVec::Heap(v);
+ }
+
+ /// Tries to move the content of the TinyVec to the heap, if it's inline.
+ ///
+ /// # Errors
+ ///
+ /// If the allocator reports a failure, then an error is returned and the
+ /// content is kept on the stack.
+ ///
+ /// ```rust
+ /// use tinyvec::*;
+ /// let mut tv = tiny_vec!([i32; 4] => 1, 2, 3);
+ /// assert!(tv.is_inline());
+ /// assert_eq!(Ok(()), tv.try_move_to_the_heap());
+ /// assert!(tv.is_heap());
+ /// ```
+ #[cfg(feature = "rustc_1_57")]
+ pub fn try_move_to_the_heap(&mut self) -> Result<(), TryReserveError> {
+ let arr = match self {
+ TinyVec::Heap(_) => return Ok(()),
+ TinyVec::Inline(a) => a,
+ };
+
+ let v = arr.try_drain_to_vec()?;
+ *self = TinyVec::Heap(v);
+ return Ok(());
+ }
+
+ /// If TinyVec is inline, moves the content of it to the heap.
+ /// Also reserves additional space.
+ /// ```rust
+ /// use tinyvec::*;
+ /// let mut tv = tiny_vec!([i32; 4] => 1, 2, 3);
+ /// assert!(tv.is_inline());
+ /// tv.move_to_the_heap_and_reserve(32);
+ /// assert!(tv.is_heap());
+ /// assert!(tv.capacity() >= 35);
+ /// ```
+ pub fn move_to_the_heap_and_reserve(&mut self, n: usize) {
+ let arr = match self {
+ TinyVec::Heap(h) => return h.reserve(n),
+ TinyVec::Inline(a) => a,
+ };
+
+ let v = arr.drain_to_vec_and_reserve(n);
+ *self = TinyVec::Heap(v);
+ }
+
+ /// If TinyVec is inline, try to move the content of it to the heap.
+ /// Also reserves additional space.
+ ///
+ /// # Errors
+ ///
+ /// If the allocator reports a failure, then an error is returned.
+ ///
+ /// ```rust
+ /// use tinyvec::*;
+ /// let mut tv = tiny_vec!([i32; 4] => 1, 2, 3);
+ /// assert!(tv.is_inline());
+ /// assert_eq!(Ok(()), tv.try_move_to_the_heap_and_reserve(32));
+ /// assert!(tv.is_heap());
+ /// assert!(tv.capacity() >= 35);
+ /// ```
+ #[cfg(feature = "rustc_1_57")]
+ pub fn try_move_to_the_heap_and_reserve(
+ &mut self, n: usize,
+ ) -> Result<(), TryReserveError> {
+ let arr = match self {
+ TinyVec::Heap(h) => return h.try_reserve(n),
+ TinyVec::Inline(a) => a,
+ };
+
+ let v = arr.try_drain_to_vec_and_reserve(n)?;
+ *self = TinyVec::Heap(v);
+ return Ok(());
+ }
+
+ /// Reserves additional space.
+ /// Moves to the heap if array can't hold `n` more items
+ /// ```rust
+ /// use tinyvec::*;
+ /// let mut tv = tiny_vec!([i32; 4] => 1, 2, 3, 4);
+ /// assert!(tv.is_inline());
+ /// tv.reserve(1);
+ /// assert!(tv.is_heap());
+ /// assert!(tv.capacity() >= 5);
+ /// ```
+ pub fn reserve(&mut self, n: usize) {
+ let arr = match self {
+ TinyVec::Heap(h) => return h.reserve(n),
+ TinyVec::Inline(a) => a,
+ };
+
+ if n > arr.capacity() - arr.len() {
+ let v = arr.drain_to_vec_and_reserve(n);
+ *self = TinyVec::Heap(v);
+ }
+
+ /* In this place array has enough place, so no work is needed more */
+ return;
+ }
+
+ /// Tries to reserve additional space.
+ /// Moves to the heap if array can't hold `n` more items.
+ ///
+ /// # Errors
+ ///
+ /// If the allocator reports a failure, then an error is returned.
+ ///
+ /// ```rust
+ /// use tinyvec::*;
+ /// let mut tv = tiny_vec!([i32; 4] => 1, 2, 3, 4);
+ /// assert!(tv.is_inline());
+ /// assert_eq!(Ok(()), tv.try_reserve(1));
+ /// assert!(tv.is_heap());
+ /// assert!(tv.capacity() >= 5);
+ /// ```
+ #[cfg(feature = "rustc_1_57")]
+ pub fn try_reserve(&mut self, n: usize) -> Result<(), TryReserveError> {
+ let arr = match self {
+ TinyVec::Heap(h) => return h.try_reserve(n),
+ TinyVec::Inline(a) => a,
+ };
+
+ if n > arr.capacity() - arr.len() {
+ let v = arr.try_drain_to_vec_and_reserve(n)?;
+ *self = TinyVec::Heap(v);
+ }
+
+ /* In this place array has enough place, so no work is needed more */
+ return Ok(());
+ }
+
+ /// Reserves additional space.
+ /// Moves to the heap if array can't hold `n` more items
+ ///
+ /// From [Vec::reserve_exact](https://doc.rust-lang.org/std/vec/struct.Vec.html#method.reserve_exact)
+ /// ```text
+ /// Note that the allocator may give the collection more space than it requests.
+ /// Therefore, capacity can not be relied upon to be precisely minimal.
+ /// Prefer `reserve` if future insertions are expected.
+ /// ```
+ /// ```rust
+ /// use tinyvec::*;
+ /// let mut tv = tiny_vec!([i32; 4] => 1, 2, 3, 4);
+ /// assert!(tv.is_inline());
+ /// tv.reserve_exact(1);
+ /// assert!(tv.is_heap());
+ /// assert!(tv.capacity() >= 5);
+ /// ```
+ pub fn reserve_exact(&mut self, n: usize) {
+ let arr = match self {
+ TinyVec::Heap(h) => return h.reserve_exact(n),
+ TinyVec::Inline(a) => a,
+ };
+
+ if n > arr.capacity() - arr.len() {
+ let v = arr.drain_to_vec_and_reserve(n);
+ *self = TinyVec::Heap(v);
+ }
+
+ /* In this place array has enough place, so no work is needed more */
+ return;
+ }
+
+ /// Tries to reserve additional space.
+ /// Moves to the heap if array can't hold `n` more items
+ ///
+ /// # Errors
+ ///
+ /// If the allocator reports a failure, then an error is returned.
+ ///
+ /// From [Vec::try_reserve_exact](https://doc.rust-lang.org/std/vec/struct.Vec.html#method.try_reserve_exact)
+ /// ```text
+ /// Note that the allocator may give the collection more space than it requests.
+ /// Therefore, capacity can not be relied upon to be precisely minimal.
+ /// Prefer `reserve` if future insertions are expected.
+ /// ```
+ /// ```rust
+ /// use tinyvec::*;
+ /// let mut tv = tiny_vec!([i32; 4] => 1, 2, 3, 4);
+ /// assert!(tv.is_inline());
+ /// assert_eq!(Ok(()), tv.try_reserve_exact(1));
+ /// assert!(tv.is_heap());
+ /// assert!(tv.capacity() >= 5);
+ /// ```
+ #[cfg(feature = "rustc_1_57")]
+ pub fn try_reserve_exact(&mut self, n: usize) -> Result<(), TryReserveError> {
+ let arr = match self {
+ TinyVec::Heap(h) => return h.try_reserve_exact(n),
+ TinyVec::Inline(a) => a,
+ };
+
+ if n > arr.capacity() - arr.len() {
+ let v = arr.try_drain_to_vec_and_reserve(n)?;
+ *self = TinyVec::Heap(v);
+ }
+
+ /* In this place array has enough place, so no work is needed more */
+ return Ok(());
+ }
+
+ /// Makes a new TinyVec with _at least_ the given capacity.
+ ///
+ /// If the requested capacity is less than or equal to the array capacity you
+ /// get an inline vec. If it's greater than you get a heap vec.
+ /// ```
+ /// # use tinyvec::*;
+ /// let t = TinyVec::<[u8; 10]>::with_capacity(5);
+ /// assert!(t.is_inline());
+ /// assert!(t.capacity() >= 5);
+ ///
+ /// let t = TinyVec::<[u8; 10]>::with_capacity(20);
+ /// assert!(t.is_heap());
+ /// assert!(t.capacity() >= 20);
+ /// ```
+ #[inline]
+ #[must_use]
+ pub fn with_capacity(cap: usize) -> Self {
+ if cap <= A::CAPACITY {
+ TinyVec::Inline(ArrayVec::default())
+ } else {
+ TinyVec::Heap(Vec::with_capacity(cap))
+ }
+ }
+}
+
+impl<A: Array> TinyVec<A> {
+ /// Move all values from `other` into this vec.
+ #[cfg(feature = "rustc_1_40")]
+ #[inline]
+ pub fn append(&mut self, other: &mut Self) {
+ self.reserve(other.len());
+
+ /* Doing append should be faster, because it is effectively a memcpy */
+ match (self, other) {
+ (TinyVec::Heap(sh), TinyVec::Heap(oh)) => sh.append(oh),
+ (TinyVec::Inline(a), TinyVec::Heap(h)) => a.extend(h.drain(..)),
+ (ref mut this, TinyVec::Inline(arr)) => this.extend(arr.drain(..)),
+ }
+ }
+
+ /// Move all values from `other` into this vec.
+ #[cfg(not(feature = "rustc_1_40"))]
+ #[inline]
+ pub fn append(&mut self, other: &mut Self) {
+ match other {
+ TinyVec::Inline(a) => self.extend(a.drain(..)),
+ TinyVec::Heap(h) => self.extend(h.drain(..)),
+ }
+ }
+
+ impl_mirrored! {
+ type Mirror = TinyVec;
+
+ /// Remove an element, swapping the end of the vec into its place.
+ ///
+ /// ## Panics
+ /// * If the index is out of bounds.
+ ///
+ /// ## Example
+ /// ```rust
+ /// use tinyvec::*;
+ /// let mut tv = tiny_vec!([&str; 4] => "foo", "bar", "quack", "zap");
+ ///
+ /// assert_eq!(tv.swap_remove(1), "bar");
+ /// assert_eq!(tv.as_slice(), &["foo", "zap", "quack"][..]);
+ ///
+ /// assert_eq!(tv.swap_remove(0), "foo");
+ /// assert_eq!(tv.as_slice(), &["quack", "zap"][..]);
+ /// ```
+ #[inline]
+ pub fn swap_remove(self: &mut Self, index: usize) -> A::Item;
+
+ /// Remove and return the last element of the vec, if there is one.
+ ///
+ /// ## Failure
+ /// * If the vec is empty you get `None`.
+ #[inline]
+ pub fn pop(self: &mut Self) -> Option<A::Item>;
+
+ /// Removes the item at `index`, shifting all others down by one index.
+ ///
+ /// Returns the removed element.
+ ///
+ /// ## Panics
+ ///
+ /// If the index is out of bounds.
+ ///
+ /// ## Example
+ ///
+ /// ```rust
+ /// use tinyvec::*;
+ /// let mut tv = tiny_vec!([i32; 4] => 1, 2, 3);
+ /// assert_eq!(tv.remove(1), 2);
+ /// assert_eq!(tv.as_slice(), &[1, 3][..]);
+ /// ```
+ #[inline]
+ pub fn remove(self: &mut Self, index: usize) -> A::Item;
+
+ /// The length of the vec (in elements).
+ #[inline(always)]
+ #[must_use]
+ pub fn len(self: &Self) -> usize;
+
+ /// The capacity of the `TinyVec`.
+ ///
+ /// When not heap allocated this is fixed based on the array type.
+ /// Otherwise its the result of the underlying Vec::capacity.
+ #[inline(always)]
+ #[must_use]
+ pub fn capacity(self: &Self) -> usize;
+
+ /// Reduces the vec's length to the given value.
+ ///
+ /// If the vec is already shorter than the input, nothing happens.
+ #[inline]
+ pub fn truncate(self: &mut Self, new_len: usize);
+
+ /// A mutable pointer to the backing array.
+ ///
+ /// ## Safety
+ ///
+ /// This pointer has provenance over the _entire_ backing array/buffer.
+ #[inline(always)]
+ #[must_use]
+ pub fn as_mut_ptr(self: &mut Self) -> *mut A::Item;
+
+ /// A const pointer to the backing array.
+ ///
+ /// ## Safety
+ ///
+ /// This pointer has provenance over the _entire_ backing array/buffer.
+ #[inline(always)]
+ #[must_use]
+ pub fn as_ptr(self: &Self) -> *const A::Item;
+ }
+
+ /// Walk the vec and keep only the elements that pass the predicate given.
+ ///
+ /// ## Example
+ ///
+ /// ```rust
+ /// use tinyvec::*;
+ ///
+ /// let mut tv = tiny_vec!([i32; 10] => 1, 2, 3, 4);
+ /// tv.retain(|&x| x % 2 == 0);
+ /// assert_eq!(tv.as_slice(), &[2, 4][..]);
+ /// ```
+ #[inline]
+ pub fn retain<F: FnMut(&A::Item) -> bool>(self: &mut Self, acceptable: F) {
+ match self {
+ TinyVec::Inline(i) => i.retain(acceptable),
+ TinyVec::Heap(h) => h.retain(acceptable),
+ }
+ }
+
+ /// Helper for getting the mut slice.
+ #[inline(always)]
+ #[must_use]
+ pub fn as_mut_slice(self: &mut Self) -> &mut [A::Item] {
+ self.deref_mut()
+ }
+
+ /// Helper for getting the shared slice.
+ #[inline(always)]
+ #[must_use]
+ pub fn as_slice(self: &Self) -> &[A::Item] {
+ self.deref()
+ }
+
+ /// Removes all elements from the vec.
+ #[inline(always)]
+ pub fn clear(&mut self) {
+ self.truncate(0)
+ }
+
+ /// De-duplicates the vec.
+ #[cfg(feature = "nightly_slice_partition_dedup")]
+ #[inline(always)]
+ pub fn dedup(&mut self)
+ where
+ A::Item: PartialEq,
+ {
+ self.dedup_by(|a, b| a == b)
+ }
+
+ /// De-duplicates the vec according to the predicate given.
+ #[cfg(feature = "nightly_slice_partition_dedup")]
+ #[inline(always)]
+ pub fn dedup_by<F>(&mut self, same_bucket: F)
+ where
+ F: FnMut(&mut A::Item, &mut A::Item) -> bool,
+ {
+ let len = {
+ let (dedup, _) = self.as_mut_slice().partition_dedup_by(same_bucket);
+ dedup.len()
+ };
+ self.truncate(len);
+ }
+
+ /// De-duplicates the vec according to the key selector given.
+ #[cfg(feature = "nightly_slice_partition_dedup")]
+ #[inline(always)]
+ pub fn dedup_by_key<F, K>(&mut self, mut key: F)
+ where
+ F: FnMut(&mut A::Item) -> K,
+ K: PartialEq,
+ {
+ self.dedup_by(|a, b| key(a) == key(b))
+ }
+
+ /// Creates a draining iterator that removes the specified range in the vector
+ /// and yields the removed items.
+ ///
+ /// **Note: This method has significant performance issues compared to
+ /// matching on the TinyVec and then calling drain on the Inline or Heap value
+ /// inside. The draining iterator has to branch on every single access. It is
+ /// provided for simplicity and compatability only.**
+ ///
+ /// ## Panics
+ /// * If the start is greater than the end
+ /// * If the end is past the edge of the vec.
+ ///
+ /// ## Example
+ /// ```rust
+ /// use tinyvec::*;
+ /// let mut tv = tiny_vec!([i32; 4] => 1, 2, 3);
+ /// let tv2: TinyVec<[i32; 4]> = tv.drain(1..).collect();
+ /// assert_eq!(tv.as_slice(), &[1][..]);
+ /// assert_eq!(tv2.as_slice(), &[2, 3][..]);
+ ///
+ /// tv.drain(..);
+ /// assert_eq!(tv.as_slice(), &[]);
+ /// ```
+ #[inline]
+ pub fn drain<R: RangeBounds<usize>>(
+ &mut self, range: R,
+ ) -> TinyVecDrain<'_, A> {
+ match self {
+ TinyVec::Inline(i) => TinyVecDrain::Inline(i.drain(range)),
+ TinyVec::Heap(h) => TinyVecDrain::Heap(h.drain(range)),
+ }
+ }
+
+ /// Clone each element of the slice into this vec.
+ /// ```rust
+ /// use tinyvec::*;
+ /// let mut tv = tiny_vec!([i32; 4] => 1, 2);
+ /// tv.extend_from_slice(&[3, 4]);
+ /// assert_eq!(tv.as_slice(), [1, 2, 3, 4]);
+ /// ```
+ #[inline]
+ pub fn extend_from_slice(&mut self, sli: &[A::Item])
+ where
+ A::Item: Clone,
+ {
+ self.reserve(sli.len());
+ match self {
+ TinyVec::Inline(a) => a.extend_from_slice(sli),
+ TinyVec::Heap(h) => h.extend_from_slice(sli),
+ }
+ }
+
+ /// Wraps up an array and uses the given length as the initial length.
+ ///
+ /// Note that the `From` impl for arrays assumes the full length is used.
+ ///
+ /// ## Panics
+ ///
+ /// The length must be less than or equal to the capacity of the array.
+ #[inline]
+ #[must_use]
+ #[allow(clippy::match_wild_err_arm)]
+ pub fn from_array_len(data: A, len: usize) -> Self {
+ match Self::try_from_array_len(data, len) {
+ Ok(out) => out,
+ Err(_) => {
+ panic!("TinyVec: length {} exceeds capacity {}!", len, A::CAPACITY)
+ }
+ }
+ }
+
+ /// This is an internal implementation detail of the `tiny_vec!` macro, and
+ /// using it other than from that macro is not supported by this crate's
+ /// SemVer guarantee.
+ #[inline(always)]
+ #[doc(hidden)]
+ pub fn constructor_for_capacity(cap: usize) -> TinyVecConstructor<A> {
+ if cap <= A::CAPACITY {
+ TinyVecConstructor::Inline(TinyVec::Inline)
+ } else {
+ TinyVecConstructor::Heap(TinyVec::Heap)
+ }
+ }
+
+ /// Inserts an item at the position given, moving all following elements +1
+ /// index.
+ ///
+ /// ## Panics
+ /// * If `index` > `len`
+ ///
+ /// ## Example
+ /// ```rust
+ /// use tinyvec::*;
+ /// let mut tv = tiny_vec!([i32; 10] => 1, 2, 3);
+ /// tv.insert(1, 4);
+ /// assert_eq!(tv.as_slice(), &[1, 4, 2, 3]);
+ /// tv.insert(4, 5);
+ /// assert_eq!(tv.as_slice(), &[1, 4, 2, 3, 5]);
+ /// ```
+ #[inline]
+ pub fn insert(&mut self, index: usize, item: A::Item) {
+ assert!(
+ index <= self.len(),
+ "insertion index (is {}) should be <= len (is {})",
+ index,
+ self.len()
+ );
+
+ let arr = match self {
+ TinyVec::Heap(v) => return v.insert(index, item),
+ TinyVec::Inline(a) => a,
+ };
+
+ if let Some(x) = arr.try_insert(index, item) {
+ let mut v = Vec::with_capacity(arr.len() * 2);
+ let mut it =
+ arr.iter_mut().map(|r| core::mem::replace(r, Default::default()));
+ v.extend(it.by_ref().take(index));
+ v.push(x);
+ v.extend(it);
+ *self = TinyVec::Heap(v);
+ }
+ }
+
+ /// If the vec is empty.
+ #[inline(always)]
+ #[must_use]
+ pub fn is_empty(&self) -> bool {
+ self.len() == 0
+ }
+
+ /// Makes a new, empty vec.
+ #[inline(always)]
+ #[must_use]
+ pub fn new() -> Self {
+ Self::default()
+ }
+
+ /// Place an element onto the end of the vec.
+ /// ## Panics
+ /// * If the length of the vec would overflow the capacity.
+ /// ```rust
+ /// use tinyvec::*;
+ /// let mut tv = tiny_vec!([i32; 10] => 1, 2, 3);
+ /// tv.push(4);
+ /// assert_eq!(tv.as_slice(), &[1, 2, 3, 4]);
+ /// ```
+ #[inline]
+ pub fn push(&mut self, val: A::Item) {
+ // The code path for moving the inline contents to the heap produces a lot
+ // of instructions, but we have a strong guarantee that this is a cold
+ // path. LLVM doesn't know this, inlines it, and this tends to cause a
+ // cascade of other bad inlining decisions because the body of push looks
+ // huge even though nearly every call executes the same few instructions.
+ //
+ // Moving the logic out of line with #[cold] causes the hot code to be
+ // inlined together, and we take the extra cost of a function call only
+ // in rare cases.
+ #[cold]
+ fn drain_to_heap_and_push<A: Array>(
+ arr: &mut ArrayVec<A>, val: A::Item,
+ ) -> TinyVec<A> {
+ /* Make the Vec twice the size to amortize the cost of draining */
+ let mut v = arr.drain_to_vec_and_reserve(arr.len());
+ v.push(val);
+ TinyVec::Heap(v)
+ }
+
+ match self {
+ TinyVec::Heap(v) => v.push(val),
+ TinyVec::Inline(arr) => {
+ if let Some(x) = arr.try_push(val) {
+ *self = drain_to_heap_and_push(arr, x);
+ }
+ }
+ }
+ }
+
+ /// Resize the vec to the new length.
+ ///
+ /// If it needs to be longer, it's filled with clones of the provided value.
+ /// If it needs to be shorter, it's truncated.
+ ///
+ /// ## Example
+ ///
+ /// ```rust
+ /// use tinyvec::*;
+ ///
+ /// let mut tv = tiny_vec!([&str; 10] => "hello");
+ /// tv.resize(3, "world");
+ /// assert_eq!(tv.as_slice(), &["hello", "world", "world"][..]);
+ ///
+ /// let mut tv = tiny_vec!([i32; 10] => 1, 2, 3, 4);
+ /// tv.resize(2, 0);
+ /// assert_eq!(tv.as_slice(), &[1, 2][..]);
+ /// ```
+ #[inline]
+ pub fn resize(&mut self, new_len: usize, new_val: A::Item)
+ where
+ A::Item: Clone,
+ {
+ self.resize_with(new_len, || new_val.clone());
+ }
+
+ /// Resize the vec to the new length.
+ ///
+ /// If it needs to be longer, it's filled with repeated calls to the provided
+ /// function. If it needs to be shorter, it's truncated.
+ ///
+ /// ## Example
+ ///
+ /// ```rust
+ /// use tinyvec::*;
+ ///
+ /// let mut tv = tiny_vec!([i32; 3] => 1, 2, 3);
+ /// tv.resize_with(5, Default::default);
+ /// assert_eq!(tv.as_slice(), &[1, 2, 3, 0, 0][..]);
+ ///
+ /// let mut tv = tiny_vec!([i32; 2]);
+ /// let mut p = 1;
+ /// tv.resize_with(4, || {
+ /// p *= 2;
+ /// p
+ /// });
+ /// assert_eq!(tv.as_slice(), &[2, 4, 8, 16][..]);
+ /// ```
+ #[inline]
+ pub fn resize_with<F: FnMut() -> A::Item>(&mut self, new_len: usize, f: F) {
+ match new_len.checked_sub(self.len()) {
+ None => return self.truncate(new_len),
+ Some(n) => self.reserve(n),
+ }
+
+ match self {
+ TinyVec::Inline(a) => a.resize_with(new_len, f),
+ TinyVec::Heap(v) => v.resize_with(new_len, f),
+ }
+ }
+
+ /// Splits the collection at the point given.
+ ///
+ /// * `[0, at)` stays in this vec
+ /// * `[at, len)` ends up in the new vec.
+ ///
+ /// ## Panics
+ /// * if at > len
+ ///
+ /// ## Example
+ ///
+ /// ```rust
+ /// use tinyvec::*;
+ /// let mut tv = tiny_vec!([i32; 4] => 1, 2, 3);
+ /// let tv2 = tv.split_off(1);
+ /// assert_eq!(tv.as_slice(), &[1][..]);
+ /// assert_eq!(tv2.as_slice(), &[2, 3][..]);
+ /// ```
+ #[inline]
+ pub fn split_off(&mut self, at: usize) -> Self {
+ match self {
+ TinyVec::Inline(a) => TinyVec::Inline(a.split_off(at)),
+ TinyVec::Heap(v) => TinyVec::Heap(v.split_off(at)),
+ }
+ }
+
+ /// Creates a splicing iterator that removes the specified range in the
+ /// vector, yields the removed items, and replaces them with elements from
+ /// the provided iterator.
+ ///
+ /// `splice` fuses the provided iterator, so elements after the first `None`
+ /// are ignored.
+ ///
+ /// ## Panics
+ /// * If the start is greater than the end.
+ /// * If the end is past the edge of the vec.
+ /// * If the provided iterator panics.
+ ///
+ /// ## Example
+ /// ```rust
+ /// use tinyvec::*;
+ /// let mut tv = tiny_vec!([i32; 4] => 1, 2, 3);
+ /// let tv2: TinyVec<[i32; 4]> = tv.splice(1.., 4..=6).collect();
+ /// assert_eq!(tv.as_slice(), &[1, 4, 5, 6][..]);
+ /// assert_eq!(tv2.as_slice(), &[2, 3][..]);
+ ///
+ /// tv.splice(.., None);
+ /// assert_eq!(tv.as_slice(), &[]);
+ /// ```
+ #[inline]
+ pub fn splice<R, I>(
+ &mut self, range: R, replacement: I,
+ ) -> TinyVecSplice<'_, A, core::iter::Fuse<I::IntoIter>>
+ where
+ R: RangeBounds<usize>,
+ I: IntoIterator<Item = A::Item>,
+ {
+ use core::ops::Bound;
+ let start = match range.start_bound() {
+ Bound::Included(x) => *x,
+ Bound::Excluded(x) => x.saturating_add(1),
+ Bound::Unbounded => 0,
+ };
+ let end = match range.end_bound() {
+ Bound::Included(x) => x.saturating_add(1),
+ Bound::Excluded(x) => *x,
+ Bound::Unbounded => self.len(),
+ };
+ assert!(
+ start <= end,
+ "TinyVec::splice> Illegal range, {} to {}",
+ start,
+ end
+ );
+ assert!(
+ end <= self.len(),
+ "TinyVec::splice> Range ends at {} but length is only {}!",
+ end,
+ self.len()
+ );
+
+ TinyVecSplice {
+ removal_start: start,
+ removal_end: end,
+ parent: self,
+ replacement: replacement.into_iter().fuse(),
+ }
+ }
+
+ /// Wraps an array, using the given length as the starting length.
+ ///
+ /// If you want to use the whole length of the array, you can just use the
+ /// `From` impl.
+ ///
+ /// ## Failure
+ ///
+ /// If the given length is greater than the capacity of the array this will
+ /// error, and you'll get the array back in the `Err`.
+ #[inline]
+ pub fn try_from_array_len(data: A, len: usize) -> Result<Self, A> {
+ let arr = ArrayVec::try_from_array_len(data, len)?;
+ Ok(TinyVec::Inline(arr))
+ }
+}
+
+/// Draining iterator for `TinyVecDrain`
+///
+/// See [`TinyVecDrain::drain`](TinyVecDrain::<A>::drain)
+#[cfg_attr(docs_rs, doc(cfg(feature = "alloc")))]
+pub enum TinyVecDrain<'p, A: Array> {
+ #[allow(missing_docs)]
+ Inline(ArrayVecDrain<'p, A::Item>),
+ #[allow(missing_docs)]
+ Heap(vec::Drain<'p, A::Item>),
+}
+
+impl<'p, A: Array> Iterator for TinyVecDrain<'p, A> {
+ type Item = A::Item;
+
+ impl_mirrored! {
+ type Mirror = TinyVecDrain;
+
+ #[inline]
+ fn next(self: &mut Self) -> Option<Self::Item>;
+ #[inline]
+ fn nth(self: &mut Self, n: usize) -> Option<Self::Item>;
+ #[inline]
+ fn size_hint(self: &Self) -> (usize, Option<usize>);
+ #[inline]
+ fn last(self: Self) -> Option<Self::Item>;
+ #[inline]
+ fn count(self: Self) -> usize;
+ }
+
+ #[inline]
+ fn for_each<F: FnMut(Self::Item)>(self, f: F) {
+ match self {
+ TinyVecDrain::Inline(i) => i.for_each(f),
+ TinyVecDrain::Heap(h) => h.for_each(f),
+ }
+ }
+}
+
+impl<'p, A: Array> DoubleEndedIterator for TinyVecDrain<'p, A> {
+ impl_mirrored! {
+ type Mirror = TinyVecDrain;
+
+ #[inline]
+ fn next_back(self: &mut Self) -> Option<Self::Item>;
+
+ #[cfg(feature = "rustc_1_40")]
+ #[inline]
+ fn nth_back(self: &mut Self, n: usize) -> Option<Self::Item>;
+ }
+}
+
+/// Splicing iterator for `TinyVec`
+/// See [`TinyVec::splice`](TinyVec::<A>::splice)
+#[cfg_attr(docs_rs, doc(cfg(feature = "alloc")))]
+pub struct TinyVecSplice<'p, A: Array, I: Iterator<Item = A::Item>> {
+ parent: &'p mut TinyVec<A>,
+ removal_start: usize,
+ removal_end: usize,
+ replacement: I,
+}
+
+impl<'p, A, I> Iterator for TinyVecSplice<'p, A, I>
+where
+ A: Array,
+ I: Iterator<Item = A::Item>,
+{
+ type Item = A::Item;
+
+ #[inline]
+ fn next(&mut self) -> Option<A::Item> {
+ if self.removal_start < self.removal_end {
+ match self.replacement.next() {
+ Some(replacement) => {
+ let removed = core::mem::replace(
+ &mut self.parent[self.removal_start],
+ replacement,
+ );
+ self.removal_start += 1;
+ Some(removed)
+ }
+ None => {
+ let removed = self.parent.remove(self.removal_start);
+ self.removal_end -= 1;
+ Some(removed)
+ }
+ }
+ } else {
+ None
+ }
+ }
+
+ #[inline]
+ fn size_hint(&self) -> (usize, Option<usize>) {
+ let len = self.len();
+ (len, Some(len))
+ }
+}
+
+impl<'p, A, I> ExactSizeIterator for TinyVecSplice<'p, A, I>
+where
+ A: Array,
+ I: Iterator<Item = A::Item>,
+{
+ #[inline]
+ fn len(&self) -> usize {
+ self.removal_end - self.removal_start
+ }
+}
+
+impl<'p, A, I> FusedIterator for TinyVecSplice<'p, A, I>
+where
+ A: Array,
+ I: Iterator<Item = A::Item>,
+{
+}
+
+impl<'p, A, I> DoubleEndedIterator for TinyVecSplice<'p, A, I>
+where
+ A: Array,
+ I: Iterator<Item = A::Item> + DoubleEndedIterator,
+{
+ #[inline]
+ fn next_back(&mut self) -> Option<A::Item> {
+ if self.removal_start < self.removal_end {
+ match self.replacement.next_back() {
+ Some(replacement) => {
+ let removed = core::mem::replace(
+ &mut self.parent[self.removal_end - 1],
+ replacement,
+ );
+ self.removal_end -= 1;
+ Some(removed)
+ }
+ None => {
+ let removed = self.parent.remove(self.removal_end - 1);
+ self.removal_end -= 1;
+ Some(removed)
+ }
+ }
+ } else {
+ None
+ }
+ }
+}
+
+impl<'p, A: Array, I: Iterator<Item = A::Item>> Drop
+ for TinyVecSplice<'p, A, I>
+{
+ fn drop(&mut self) {
+ for _ in self.by_ref() {}
+
+ let (lower_bound, _) = self.replacement.size_hint();
+ self.parent.reserve(lower_bound);
+
+ for replacement in self.replacement.by_ref() {
+ self.parent.insert(self.removal_end, replacement);
+ self.removal_end += 1;
+ }
+ }
+}
+
+impl<A: Array> AsMut<[A::Item]> for TinyVec<A> {
+ #[inline(always)]
+ #[must_use]
+ fn as_mut(&mut self) -> &mut [A::Item] {
+ &mut *self
+ }
+}
+
+impl<A: Array> AsRef<[A::Item]> for TinyVec<A> {
+ #[inline(always)]
+ #[must_use]
+ fn as_ref(&self) -> &[A::Item] {
+ &*self
+ }
+}
+
+impl<A: Array> Borrow<[A::Item]> for TinyVec<A> {
+ #[inline(always)]
+ #[must_use]
+ fn borrow(&self) -> &[A::Item] {
+ &*self
+ }
+}
+
+impl<A: Array> BorrowMut<[A::Item]> for TinyVec<A> {
+ #[inline(always)]
+ #[must_use]
+ fn borrow_mut(&mut self) -> &mut [A::Item] {
+ &mut *self
+ }
+}
+
+impl<A: Array> Extend<A::Item> for TinyVec<A> {
+ #[inline]
+ fn extend<T: IntoIterator<Item = A::Item>>(&mut self, iter: T) {
+ let iter = iter.into_iter();
+ let (lower_bound, _) = iter.size_hint();
+ self.reserve(lower_bound);
+
+ let a = match self {
+ TinyVec::Heap(h) => return h.extend(iter),
+ TinyVec::Inline(a) => a,
+ };
+
+ let mut iter = a.fill(iter);
+ let maybe = iter.next();
+
+ let surely = match maybe {
+ Some(x) => x,
+ None => return,
+ };
+
+ let mut v = a.drain_to_vec_and_reserve(a.len());
+ v.push(surely);
+ v.extend(iter);
+ *self = TinyVec::Heap(v);
+ }
+}
+
+impl<A: Array> From<ArrayVec<A>> for TinyVec<A> {
+ #[inline(always)]
+ #[must_use]
+ fn from(arr: ArrayVec<A>) -> Self {
+ TinyVec::Inline(arr)
+ }
+}
+
+impl<A: Array> From<A> for TinyVec<A> {
+ fn from(array: A) -> Self {
+ TinyVec::Inline(ArrayVec::from(array))
+ }
+}
+
+impl<T, A> From<&'_ [T]> for TinyVec<A>
+where
+ T: Clone + Default,
+ A: Array<Item = T>,
+{
+ #[inline]
+ #[must_use]
+ fn from(slice: &[T]) -> Self {
+ if let Ok(arr) = ArrayVec::try_from(slice) {
+ TinyVec::Inline(arr)
+ } else {
+ TinyVec::Heap(slice.into())
+ }
+ }
+}
+
+impl<T, A> From<&'_ mut [T]> for TinyVec<A>
+where
+ T: Clone + Default,
+ A: Array<Item = T>,
+{
+ #[inline]
+ #[must_use]
+ fn from(slice: &mut [T]) -> Self {
+ Self::from(&*slice)
+ }
+}
+
+impl<A: Array> FromIterator<A::Item> for TinyVec<A> {
+ #[inline]
+ #[must_use]
+ fn from_iter<T: IntoIterator<Item = A::Item>>(iter: T) -> Self {
+ let mut av = Self::default();
+ av.extend(iter);
+ av
+ }
+}
+
+/// Iterator for consuming an `TinyVec` and returning owned elements.
+#[cfg_attr(docs_rs, doc(cfg(feature = "alloc")))]
+pub enum TinyVecIterator<A: Array> {
+ #[allow(missing_docs)]
+ Inline(ArrayVecIterator<A>),
+ #[allow(missing_docs)]
+ Heap(alloc::vec::IntoIter<A::Item>),
+}
+
+impl<A: Array> TinyVecIterator<A> {
+ impl_mirrored! {
+ type Mirror = TinyVecIterator;
+ /// Returns the remaining items of this iterator as a slice.
+ #[inline]
+ #[must_use]
+ pub fn as_slice(self: &Self) -> &[A::Item];
+ }
+}
+
+impl<A: Array> FusedIterator for TinyVecIterator<A> {}
+
+impl<A: Array> Iterator for TinyVecIterator<A> {
+ type Item = A::Item;
+
+ impl_mirrored! {
+ type Mirror = TinyVecIterator;
+
+ #[inline]
+ fn next(self: &mut Self) -> Option<Self::Item>;
+
+ #[inline(always)]
+ #[must_use]
+ fn size_hint(self: &Self) -> (usize, Option<usize>);
+
+ #[inline(always)]
+ fn count(self: Self) -> usize;
+
+ #[inline]
+ fn last(self: Self) -> Option<Self::Item>;
+
+ #[inline]
+ fn nth(self: &mut Self, n: usize) -> Option<A::Item>;
+ }
+}
+
+impl<A: Array> DoubleEndedIterator for TinyVecIterator<A> {
+ impl_mirrored! {
+ type Mirror = TinyVecIterator;
+
+ #[inline]
+ fn next_back(self: &mut Self) -> Option<Self::Item>;
+
+ #[cfg(feature = "rustc_1_40")]
+ #[inline]
+ fn nth_back(self: &mut Self, n: usize) -> Option<Self::Item>;
+ }
+}
+
+impl<A: Array> Debug for TinyVecIterator<A>
+where
+ A::Item: Debug,
+{
+ #[allow(clippy::missing_inline_in_public_items)]
+ fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result {
+ f.debug_tuple("TinyVecIterator").field(&self.as_slice()).finish()
+ }
+}
+
+impl<A: Array> IntoIterator for TinyVec<A> {
+ type Item = A::Item;
+ type IntoIter = TinyVecIterator<A>;
+ #[inline(always)]
+ #[must_use]
+ fn into_iter(self) -> Self::IntoIter {
+ match self {
+ TinyVec::Inline(a) => TinyVecIterator::Inline(a.into_iter()),
+ TinyVec::Heap(v) => TinyVecIterator::Heap(v.into_iter()),
+ }
+ }
+}
+
+impl<'a, A: Array> IntoIterator for &'a mut TinyVec<A> {
+ type Item = &'a mut A::Item;
+ type IntoIter = core::slice::IterMut<'a, A::Item>;
+ #[inline(always)]
+ #[must_use]
+ fn into_iter(self) -> Self::IntoIter {
+ self.iter_mut()
+ }
+}
+
+impl<'a, A: Array> IntoIterator for &'a TinyVec<A> {
+ type Item = &'a A::Item;
+ type IntoIter = core::slice::Iter<'a, A::Item>;
+ #[inline(always)]
+ #[must_use]
+ fn into_iter(self) -> Self::IntoIter {
+ self.iter()
+ }
+}
+
+impl<A: Array> PartialEq for TinyVec<A>
+where
+ A::Item: PartialEq,
+{
+ #[inline]
+ #[must_use]
+ fn eq(&self, other: &Self) -> bool {
+ self.as_slice().eq(other.as_slice())
+ }
+}
+impl<A: Array> Eq for TinyVec<A> where A::Item: Eq {}
+
+impl<A: Array> PartialOrd for TinyVec<A>
+where
+ A::Item: PartialOrd,
+{
+ #[inline]
+ #[must_use]
+ fn partial_cmp(&self, other: &Self) -> Option<core::cmp::Ordering> {
+ self.as_slice().partial_cmp(other.as_slice())
+ }
+}
+impl<A: Array> Ord for TinyVec<A>
+where
+ A::Item: Ord,
+{
+ #[inline]
+ #[must_use]
+ fn cmp(&self, other: &Self) -> core::cmp::Ordering {
+ self.as_slice().cmp(other.as_slice())
+ }
+}
+
+impl<A: Array> PartialEq<&A> for TinyVec<A>
+where
+ A::Item: PartialEq,
+{
+ #[inline]
+ #[must_use]
+ fn eq(&self, other: &&A) -> bool {
+ self.as_slice().eq(other.as_slice())
+ }
+}
+
+impl<A: Array> PartialEq<&[A::Item]> for TinyVec<A>
+where
+ A::Item: PartialEq,
+{
+ #[inline]
+ #[must_use]
+ fn eq(&self, other: &&[A::Item]) -> bool {
+ self.as_slice().eq(*other)
+ }
+}
+
+impl<A: Array> Hash for TinyVec<A>
+where
+ A::Item: Hash,
+{
+ #[inline]
+ fn hash<H: Hasher>(&self, state: &mut H) {
+ self.as_slice().hash(state)
+ }
+}
+
+// // // // // // // //
+// Formatting impls
+// // // // // // // //
+
+impl<A: Array> Binary for TinyVec<A>
+where
+ A::Item: Binary,
+{
+ #[allow(clippy::missing_inline_in_public_items)]
+ fn fmt(&self, f: &mut Formatter) -> core::fmt::Result {
+ write!(f, "[")?;
+ if f.alternate() {
+ write!(f, "\n ")?;
+ }
+ for (i, elem) in self.iter().enumerate() {
+ if i > 0 {
+ write!(f, ",{}", if f.alternate() { "\n " } else { " " })?;
+ }
+ Binary::fmt(elem, f)?;
+ }
+ if f.alternate() {
+ write!(f, ",\n")?;
+ }
+ write!(f, "]")
+ }
+}
+
+impl<A: Array> Debug for TinyVec<A>
+where
+ A::Item: Debug,
+{
+ #[allow(clippy::missing_inline_in_public_items)]
+ fn fmt(&self, f: &mut Formatter) -> core::fmt::Result {
+ write!(f, "[")?;
+ if f.alternate() {
+ write!(f, "\n ")?;
+ }
+ for (i, elem) in self.iter().enumerate() {
+ if i > 0 {
+ write!(f, ",{}", if f.alternate() { "\n " } else { " " })?;
+ }
+ Debug::fmt(elem, f)?;
+ }
+ if f.alternate() {
+ write!(f, ",\n")?;
+ }
+ write!(f, "]")
+ }
+}
+
+impl<A: Array> Display for TinyVec<A>
+where
+ A::Item: Display,
+{
+ #[allow(clippy::missing_inline_in_public_items)]
+ fn fmt(&self, f: &mut Formatter) -> core::fmt::Result {
+ write!(f, "[")?;
+ if f.alternate() {
+ write!(f, "\n ")?;
+ }
+ for (i, elem) in self.iter().enumerate() {
+ if i > 0 {
+ write!(f, ",{}", if f.alternate() { "\n " } else { " " })?;
+ }
+ Display::fmt(elem, f)?;
+ }
+ if f.alternate() {
+ write!(f, ",\n")?;
+ }
+ write!(f, "]")
+ }
+}
+
+impl<A: Array> LowerExp for TinyVec<A>
+where
+ A::Item: LowerExp,
+{
+ #[allow(clippy::missing_inline_in_public_items)]
+ fn fmt(&self, f: &mut Formatter) -> core::fmt::Result {
+ write!(f, "[")?;
+ if f.alternate() {
+ write!(f, "\n ")?;
+ }
+ for (i, elem) in self.iter().enumerate() {
+ if i > 0 {
+ write!(f, ",{}", if f.alternate() { "\n " } else { " " })?;
+ }
+ LowerExp::fmt(elem, f)?;
+ }
+ if f.alternate() {
+ write!(f, ",\n")?;
+ }
+ write!(f, "]")
+ }
+}
+
+impl<A: Array> LowerHex for TinyVec<A>
+where
+ A::Item: LowerHex,
+{
+ #[allow(clippy::missing_inline_in_public_items)]
+ fn fmt(&self, f: &mut Formatter) -> core::fmt::Result {
+ write!(f, "[")?;
+ if f.alternate() {
+ write!(f, "\n ")?;
+ }
+ for (i, elem) in self.iter().enumerate() {
+ if i > 0 {
+ write!(f, ",{}", if f.alternate() { "\n " } else { " " })?;
+ }
+ LowerHex::fmt(elem, f)?;
+ }
+ if f.alternate() {
+ write!(f, ",\n")?;
+ }
+ write!(f, "]")
+ }
+}
+
+impl<A: Array> Octal for TinyVec<A>
+where
+ A::Item: Octal,
+{
+ #[allow(clippy::missing_inline_in_public_items)]
+ fn fmt(&self, f: &mut Formatter) -> core::fmt::Result {
+ write!(f, "[")?;
+ if f.alternate() {
+ write!(f, "\n ")?;
+ }
+ for (i, elem) in self.iter().enumerate() {
+ if i > 0 {
+ write!(f, ",{}", if f.alternate() { "\n " } else { " " })?;
+ }
+ Octal::fmt(elem, f)?;
+ }
+ if f.alternate() {
+ write!(f, ",\n")?;
+ }
+ write!(f, "]")
+ }
+}
+
+impl<A: Array> Pointer for TinyVec<A>
+where
+ A::Item: Pointer,
+{
+ #[allow(clippy::missing_inline_in_public_items)]
+ fn fmt(&self, f: &mut Formatter) -> core::fmt::Result {
+ write!(f, "[")?;
+ if f.alternate() {
+ write!(f, "\n ")?;
+ }
+ for (i, elem) in self.iter().enumerate() {
+ if i > 0 {
+ write!(f, ",{}", if f.alternate() { "\n " } else { " " })?;
+ }
+ Pointer::fmt(elem, f)?;
+ }
+ if f.alternate() {
+ write!(f, ",\n")?;
+ }
+ write!(f, "]")
+ }
+}
+
+impl<A: Array> UpperExp for TinyVec<A>
+where
+ A::Item: UpperExp,
+{
+ #[allow(clippy::missing_inline_in_public_items)]
+ fn fmt(&self, f: &mut Formatter) -> core::fmt::Result {
+ write!(f, "[")?;
+ if f.alternate() {
+ write!(f, "\n ")?;
+ }
+ for (i, elem) in self.iter().enumerate() {
+ if i > 0 {
+ write!(f, ",{}", if f.alternate() { "\n " } else { " " })?;
+ }
+ UpperExp::fmt(elem, f)?;
+ }
+ if f.alternate() {
+ write!(f, ",\n")?;
+ }
+ write!(f, "]")
+ }
+}
+
+impl<A: Array> UpperHex for TinyVec<A>
+where
+ A::Item: UpperHex,
+{
+ #[allow(clippy::missing_inline_in_public_items)]
+ fn fmt(&self, f: &mut Formatter) -> core::fmt::Result {
+ write!(f, "[")?;
+ if f.alternate() {
+ write!(f, "\n ")?;
+ }
+ for (i, elem) in self.iter().enumerate() {
+ if i > 0 {
+ write!(f, ",{}", if f.alternate() { "\n " } else { " " })?;
+ }
+ UpperHex::fmt(elem, f)?;
+ }
+ if f.alternate() {
+ write!(f, ",\n")?;
+ }
+ write!(f, "]")
+ }
+}
+
+#[cfg(feature = "serde")]
+#[cfg_attr(docs_rs, doc(cfg(feature = "alloc")))]
+struct TinyVecVisitor<A: Array>(PhantomData<A>);
+
+#[cfg(feature = "serde")]
+impl<'de, A: Array> Visitor<'de> for TinyVecVisitor<A>
+where
+ A::Item: Deserialize<'de>,
+{
+ type Value = TinyVec<A>;
+
+ fn expecting(
+ &self, formatter: &mut core::fmt::Formatter,
+ ) -> core::fmt::Result {
+ formatter.write_str("a sequence")
+ }
+
+ fn visit_seq<S>(self, mut seq: S) -> Result<Self::Value, S::Error>
+ where
+ S: SeqAccess<'de>,
+ {
+ let mut new_tinyvec = match seq.size_hint() {
+ Some(expected_size) => TinyVec::with_capacity(expected_size),
+ None => Default::default(),
+ };
+
+ while let Some(value) = seq.next_element()? {
+ new_tinyvec.push(value);
+ }
+
+ Ok(new_tinyvec)
+ }
+}
diff --git a/vendor/tinyvec/tests/arrayvec.rs b/vendor/tinyvec/tests/arrayvec.rs
new file mode 100644
index 000000000..e400317c3
--- /dev/null
+++ b/vendor/tinyvec/tests/arrayvec.rs
@@ -0,0 +1,477 @@
+#![allow(bad_style)]
+
+#[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().nth(0), 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,
+ ],
+ );
+}
+
+#[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 doesnt_fit: Result<ArrayVec<[i32; 2]>, _> =
+ ArrayVec::try_from(&nums[..4]);
+ assert!(doesnt_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);
+}
diff --git a/vendor/tinyvec/tests/tinyvec.rs b/vendor/tinyvec/tests/tinyvec.rs
new file mode 100644
index 000000000..658462ae5
--- /dev/null
+++ b/vendor/tinyvec/tests/tinyvec.rs
@@ -0,0 +1,468 @@
+#![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,
+ ],
+ );
+}
+
+#[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']);
+}