summaryrefslogtreecommitdiff
path: root/vendor/tinyvec/src
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-07-17 12:37:14 -0600
committermo khan <mo@mokhan.ca>2025-07-17 12:37:14 -0600
commit814a864184affab624f7d1e5314cd1f55d72b90c (patch)
tree0271aea841154d214471427bfcfa9d928636749e /vendor/tinyvec/src
parent09e0702b7519fd06f6ba953eabae1b838896158b (diff)
refactor: remove cedar
Diffstat (limited to 'vendor/tinyvec/src')
-rw-r--r--vendor/tinyvec/src/array.rs54
-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/array/generic_array_impl.rs26
-rw-r--r--vendor/tinyvec/src/arrayvec.rs2079
-rw-r--r--vendor/tinyvec/src/arrayvec_drain.rs99
-rw-r--r--vendor/tinyvec/src/lib.rs112
-rw-r--r--vendor/tinyvec/src/slicevec.rs1083
-rw-r--r--vendor/tinyvec/src/tinyvec.rs1910
9 files changed, 0 insertions, 15002 deletions
diff --git a/vendor/tinyvec/src/array.rs b/vendor/tinyvec/src/array.rs
deleted file mode 100644
index 79bbc7cf..00000000
--- a/vendor/tinyvec/src/array.rs
+++ /dev/null
@@ -1,54 +0,0 @@
-/// 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(all(feature = "generic-array", not(feature = "rustc_1_55")))]
-core::compile_error!("generic-array requires `rustc_1_55` feature");
-
-#[cfg(feature = "rustc_1_55")]
-mod const_generic_impl;
-
-#[cfg(not(feature = "rustc_1_55"))]
-mod generated_impl;
-
-#[cfg(feature = "generic-array")]
-mod generic_array_impl;
diff --git a/vendor/tinyvec/src/array/const_generic_impl.rs b/vendor/tinyvec/src/array/const_generic_impl.rs
deleted file mode 100644
index 0b145f16..00000000
--- a/vendor/tinyvec/src/array/const_generic_impl.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-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
deleted file mode 100644
index d72169c5..00000000
--- a/vendor/tinyvec/src/array/generated_impl.rs
+++ /dev/null
@@ -1,9616 +0,0 @@
-// 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/array/generic_array_impl.rs b/vendor/tinyvec/src/array/generic_array_impl.rs
deleted file mode 100644
index 29dbd858..00000000
--- a/vendor/tinyvec/src/array/generic_array_impl.rs
+++ /dev/null
@@ -1,26 +0,0 @@
-use core::default;
-
-use super::Array;
-use generic_array::{ArrayLength, GenericArray};
-
-impl<T: Default, N: ArrayLength> Array for GenericArray<T, N> {
- type Item = T;
- const CAPACITY: usize = N::USIZE;
-
- #[inline(always)]
- #[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 {
- <Self as Default>::default()
- }
-}
diff --git a/vendor/tinyvec/src/arrayvec.rs b/vendor/tinyvec/src/arrayvec.rs
deleted file mode 100644
index 0f8d7180..00000000
--- a/vendor/tinyvec/src/arrayvec.rs
+++ /dev/null
@@ -1,2079 +0,0 @@
-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 minimum of the array size
-/// and `u16::MAX`. Note that not all capacities are necessarily supported by
-/// default. See comments in [`Array`].
-/// * `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(core::mem::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> {
- #[inline]
- 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(feature = "borsh")]
-#[cfg_attr(docs_rs, doc(cfg(feature = "borsh")))]
-impl<A: Array> borsh::BorshSerialize for ArrayVec<A>
-where
- <A as Array>::Item: borsh::BorshSerialize,
-{
- fn serialize<W: borsh::io::Write>(
- &self, writer: &mut W,
- ) -> borsh::io::Result<()> {
- <usize as borsh::BorshSerialize>::serialize(&self.len(), writer)?;
- for elem in self.iter() {
- <<A as Array>::Item as borsh::BorshSerialize>::serialize(elem, writer)?;
- }
- Ok(())
- }
-}
-
-#[cfg(feature = "borsh")]
-#[cfg_attr(docs_rs, doc(cfg(feature = "borsh")))]
-impl<A: Array> borsh::BorshDeserialize for ArrayVec<A>
-where
- <A as Array>::Item: borsh::BorshDeserialize,
-{
- fn deserialize_reader<R: borsh::io::Read>(
- reader: &mut R,
- ) -> borsh::io::Result<Self> {
- let len = <usize as borsh::BorshDeserialize>::deserialize_reader(reader)?;
- let mut new_arrayvec = Self::default();
-
- for idx in 0..len {
- let value =
- <<A as Array>::Item as borsh::BorshDeserialize>::deserialize_reader(
- reader,
- )?;
- if idx >= new_arrayvec.capacity() {
- return Err(borsh::io::Error::new(
- borsh::io::ErrorKind::InvalidData,
- "invalid ArrayVec length",
- ));
- }
- new_arrayvec.push(value)
- }
-
- Ok(new_arrayvec)
- }
-}
-
-#[cfg(feature = "arbitrary")]
-#[cfg_attr(docs_rs, doc(cfg(feature = "arbitrary")))]
-impl<'a, A> arbitrary::Arbitrary<'a> for ArrayVec<A>
-where
- A: Array,
- A::Item: arbitrary::Arbitrary<'a>,
-{
- fn arbitrary(u: &mut arbitrary::Unstructured<'a>) -> arbitrary::Result<Self> {
- let max_len = A::CAPACITY.min(u16::MAX as usize) as u16;
- let len = u.int_in_range::<u16>(0..=max_len)?;
- let mut self_: Self = Default::default();
- for _ in 0..len {
- self_.push(u.arbitrary()?);
- }
- Ok(self_)
- }
-
- fn size_hint(depth: usize) -> (usize, Option<usize>) {
- arbitrary::size_hint::recursion_guard(depth, |depth| {
- let max_len = A::CAPACITY.min(u16::MAX as usize);
- let inner = A::Item::size_hint(depth).1;
- (0, inner.map(|inner| 2 + max_len * inner))
- })
- }
-}
-
-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(core::mem::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().min(u16::MAX as usize)
- }
-
- /// 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..];
- #[allow(clippy::needless_range_loop)]
- 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 =
- core::mem::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 = core::mem::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 _ = core::mem::take(&mut rest.items[idx]);
- self.len -= 1;
- rest.tail_start += 1;
- } else {
- rest.items.swap(rest.done_end, idx);
- rest.done_end += 1;
- }
- }
- }
-
- /// Retains only the elements specified by the predicate, passing a mutable
- /// reference to it.
- ///
- /// In other words, remove all elements e such that f(&mut e) returns false.
- /// This method operates in place, visiting each element exactly once in the
- /// original order, and preserves the order of the retained elements.
- ///
- ///
- /// ## Example
- ///
- /// ```rust
- /// # use tinyvec::*;
- ///
- /// let mut av = array_vec!([i32; 10] => 1, 1, 2, 3, 3, 4);
- /// av.retain_mut(|x| if *x % 2 == 0 { *x *= 2; true } else { false });
- /// assert_eq!(&av[..], [4, 8]);
- /// ```
- #[inline]
- pub fn retain_mut<F>(&mut self, mut acceptable: F)
- where
- F: FnMut(&mut A::Item) -> bool,
- {
- // 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(&mut rest.items[idx]) {
- let _ = core::mem::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(core::mem::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]
- #[cfg(not(feature = "latest_stable_rust"))]
- 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)
- }
- }
-
- /// 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]
- #[cfg(feature = "latest_stable_rust")]
- pub const 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))
- }
-}
-
-impl<A> ArrayVec<A> {
- /// Returns the reference to the inner array of the `ArrayVec`.
- ///
- /// This returns the full array, even if the `ArrayVec` length is currently
- /// less than that.
- #[inline(always)]
- #[must_use]
- pub const fn as_inner(&self) -> &A {
- &self.data
- }
-}
-
-/// 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>
-{
- #[inline]
- 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 {
- #[inline]
- 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]
- /// 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(core::mem::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(core::mem::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(core::mem::take(item));
- }
-
- #[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(core::mem::take(item));
- }
-
- self.tail = self.base;
- return None;
- }
-}
-
-impl<A: Array> ExactSizeIterator for ArrayVecIterator<A> {
- #[inline]
- fn len(&self) -> usize {
- self.size_hint().0
- }
-}
-
-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() && !self.is_empty() {
- 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() && !self.is_empty() {
- 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);
- /// ```
- #[inline]
- 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(core::mem::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);
- /// ```
- #[inline]
- #[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(core::mem::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);
- /// ```
- #[inline]
- 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);
- /// ```
- #[inline]
- #[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)
- }
-}
-
-#[cfg(test)]
-mod test {
- use super::*;
-
- #[test]
- fn retain_mut_empty_vec() {
- let mut av: ArrayVec<[i32; 4]> = ArrayVec::new();
- av.retain_mut(|&mut x| x % 2 == 0);
- assert_eq!(av.len(), 0);
- }
-
- #[test]
- fn retain_mut_all_elements() {
- let mut av: ArrayVec<[i32; 4]> = array_vec!([i32; 4] => 2, 4, 6, 8);
- av.retain_mut(|&mut x| x % 2 == 0);
- assert_eq!(av.len(), 4);
- assert_eq!(av.as_slice(), &[2, 4, 6, 8]);
- }
-
- #[test]
- fn retain_mut_some_elements() {
- let mut av: ArrayVec<[i32; 4]> = array_vec!([i32; 4] => 1, 2, 3, 4);
- av.retain_mut(|&mut x| x % 2 == 0);
- assert_eq!(av.len(), 2);
- assert_eq!(av.as_slice(), &[2, 4]);
- }
-
- #[test]
- fn retain_mut_no_elements() {
- let mut av: ArrayVec<[i32; 4]> = array_vec!([i32; 4] => 1, 3, 5, 7);
- av.retain_mut(|&mut x| x % 2 == 0);
- assert_eq!(av.len(), 0);
- }
-
- #[test]
- fn retain_mut_zero_capacity() {
- let mut av: ArrayVec<[i32; 0]> = ArrayVec::new();
- av.retain_mut(|&mut x| x % 2 == 0);
- assert_eq!(av.len(), 0);
- }
-}
diff --git a/vendor/tinyvec/src/arrayvec_drain.rs b/vendor/tinyvec/src/arrayvec_drain.rs
deleted file mode 100644
index 3b1fcfd4..00000000
--- a/vendor/tinyvec/src/arrayvec_drain.rs
+++ /dev/null
@@ -1,99 +0,0 @@
-use super::*;
-
-use core::{
- ops::{Bound, RangeBounds},
- slice,
-};
-
-/// Draining iterator for [`ArrayVec`]
-///
-/// See [`ArrayVec::drain`](ArrayVec::drain)
-pub struct ArrayVecDrain<'a, T: 'a + Default> {
- iter: slice::IterMut<'a, T>,
-}
-
-impl<'a, T: 'a + Default> ArrayVecDrain<'a, T> {
- pub(crate) fn new<A, R>(arr: &'a mut ArrayVec<A>, range: R) -> Self
- where
- A: Array<Item = T>,
- R: RangeBounds<usize>,
- {
- let start = match range.start_bound() {
- Bound::Unbounded => 0,
- Bound::Included(&n) => n,
- Bound::Excluded(&n) => n.saturating_add(1),
- };
- let end = match range.end_bound() {
- Bound::Unbounded => arr.len(),
- Bound::Included(&n) => n.saturating_add(1),
- Bound::Excluded(&n) => n,
- };
-
- assert!(
- start <= end,
- "ArrayVec::drain> Illegal range, {} to {}",
- start,
- end
- );
- assert!(
- end <= arr.len(),
- "ArrayVec::drain> Range ends at {}, but length is only {}",
- end,
- arr.len()
- );
-
- let len = end - start;
- let to_rotate = &mut arr[start..];
- to_rotate.rotate_left(len);
-
- let oldlen = arr.len();
- let newlen = oldlen - len;
- arr.set_len(newlen);
- let slice = &mut arr.data.as_slice_mut()[newlen..oldlen];
- let iter = slice.iter_mut();
- Self { iter }
- }
-}
-
-impl<'a, T: 'a + Default> DoubleEndedIterator for ArrayVecDrain<'a, T> {
- #[inline]
- fn next_back(&mut self) -> Option<Self::Item> {
- self.iter.next_back().map(core::mem::take)
- }
-
- #[inline]
- fn nth_back(&mut self, n: usize) -> Option<Self::Item> {
- self.iter.nth_back(n).map(core::mem::take)
- }
-}
-
-impl<'a, T: 'a + Default> Iterator for ArrayVecDrain<'a, T> {
- type Item = T;
- #[inline]
- fn next(&mut self) -> Option<Self::Item> {
- self.iter.next().map(core::mem::take)
- }
- #[inline]
- fn size_hint(&self) -> (usize, Option<usize>) {
- self.iter.size_hint()
- }
- #[inline]
- fn nth(&mut self, n: usize) -> Option<Self::Item> {
- self.iter.nth(n).map(core::mem::take)
- }
- #[inline]
- fn last(self) -> Option<Self::Item> {
- self.iter.last().map(core::mem::take)
- }
- #[inline]
- fn for_each<F>(self, f: F)
- where
- F: FnMut(Self::Item),
- {
- self.iter.map(core::mem::take).for_each(f)
- }
-}
-
-impl<'a, T: 'a + Default> FusedIterator for ArrayVecDrain<'a, T> {}
-impl<'a, T: 'a + Default> ExactSizeIterator for ArrayVecDrain<'a, T> {}
-/* No need to impl Drop! */
diff --git a/vendor/tinyvec/src/lib.rs b/vendor/tinyvec/src/lib.rs
deleted file mode 100644
index fb558e71..00000000
--- a/vendor/tinyvec/src/lib.rs
+++ /dev/null
@@ -1,112 +0,0 @@
-#![cfg_attr(not(feature = "std"), no_std)]
-#![forbid(unsafe_code)]
-#![cfg_attr(
- feature = "nightly_slice_partition_dedup",
- feature(slice_partition_dedup)
-)]
-#![cfg_attr(
- feature = "debugger_visualizer",
- feature(debugger_visualizer),
- debugger_visualizer(natvis_file = "../debug_metadata/tinyvec.natvis")
-)]
-#![cfg_attr(docsrs, feature(doc_cfg))]
-#![warn(clippy::missing_inline_in_public_items)]
-#![warn(clippy::must_use_candidate)]
-#![warn(missing_docs)]
-#![allow(clippy::borrow_deref_ref)]
-#![allow(unused_imports)]
-#![allow(unused_mut)]
-#![allow(clippy::write_with_newline)]
-#![allow(clippy::needless_return)]
-
-//! `tinyvec` provides 100% safe vec-like data structures.
-//!
-//! ## Provided Types
-//! With no features enabled, this crate provides the [`ArrayVec`] type, which
-//! is an array-backed storage. You can push values into the array and pop them
-//! out of the array and so on. If the array is made to overflow it will panic.
-//!
-//! Similarly, there is also a [`SliceVec`] type available, which is a vec-like
-//! that's backed by a slice you provide. You can add and remove elements, but
-//! if you overflow the slice it will panic.
-//!
-//! With the `alloc` feature enabled, the crate also has a [`TinyVec`] type.
-//! This is an enum type which is either an `Inline(ArrayVec)` or a `Heap(Vec)`.
-//! If a `TinyVec` is `Inline` and would overflow it automatically transitions
-//! itself into being `Heap` mode instead of a panic.
-//!
-//! All of this is done with no `unsafe` code within the crate. Technically the
-//! `Vec` type from the standard library uses `unsafe` internally, but *this
-//! crate* introduces no new `unsafe` code into your project.
-//!
-//! The limitation is that the element type of a vec from this crate must
-//! support the [`Default`] trait. This means that this crate isn't suitable for
-//! all situations, but a very surprising number of types do support `Default`.
-//!
-//! ## Other Features
-//! * `grab_spare_slice` lets you get access to the "inactive" portions of an
-//! ArrayVec.
-//! * `serde` provides a `Serialize` and `Deserialize` implementation for
-//! [`TinyVec`] and [`ArrayVec`] types, provided the inner item also has an
-//! implementation.
-//! * `borsh` provides a `BorshSerialize` and `BorshDeserialize` implementation
-//! for [`TinyVec`] and [`ArrayVec`] types, provided the inner item also has
-//! an implementation.
-//!
-//! ## API
-//! The general goal of the crate is that, as much as possible, the vecs here
-//! should be a "drop in" replacement for the standard library `Vec` type. We
-//! strive to provide all of the `Vec` methods with the same names and
-//! signatures. The exception is that the element type of some methods will have
-//! a `Default` bound that's not part of the normal `Vec` type.
-//!
-//! The vecs here also have a few additional methods that aren't on the `Vec`
-//! type. In this case, the names tend to be fairly long so that they are
-//! unlikely to clash with any future methods added to `Vec`.
-//!
-//! ## 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::*;
diff --git a/vendor/tinyvec/src/slicevec.rs b/vendor/tinyvec/src/slicevec.rs
deleted file mode 100644
index c56071f0..00000000
--- a/vendor/tinyvec/src/slicevec.rs
+++ /dev/null
@@ -1,1083 +0,0 @@
-#![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 = core::mem::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 = core::mem::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 _ = core::mem::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] = core::mem::take(&mut self.data);
- 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);
- /// ```
- #[must_use]
- #[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[..]);
- /// ```
- #[inline]
- 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);
- /// ```
- #[inline]
- 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 = core::mem::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() && !self.is_empty() {
- 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() && !self.is_empty() {
- 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
deleted file mode 100644
index 7e23c371..00000000
--- a/vendor/tinyvec/src/tinyvec.rs
+++ /dev/null
@@ -1,1910 +0,0 @@
-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(docsrs, 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(docsrs, 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 = "borsh")]
-#[cfg_attr(docs_rs, doc(cfg(feature = "borsh")))]
-impl<A: Array> borsh::BorshSerialize for TinyVec<A>
-where
- <A as Array>::Item: borsh::BorshSerialize,
-{
- fn serialize<W: borsh::io::Write>(
- &self, writer: &mut W,
- ) -> borsh::io::Result<()> {
- <usize as borsh::BorshSerialize>::serialize(&self.len(), writer)?;
- for elem in self.iter() {
- <<A as Array>::Item as borsh::BorshSerialize>::serialize(elem, writer)?;
- }
- Ok(())
- }
-}
-
-#[cfg(feature = "borsh")]
-#[cfg_attr(docs_rs, doc(cfg(feature = "borsh")))]
-impl<A: Array> borsh::BorshDeserialize for TinyVec<A>
-where
- <A as Array>::Item: borsh::BorshDeserialize,
-{
- fn deserialize_reader<R: borsh::io::Read>(
- reader: &mut R,
- ) -> borsh::io::Result<Self> {
- let len = <usize as borsh::BorshDeserialize>::deserialize_reader(reader)?;
- let mut new_tinyvec = Self::with_capacity(len);
-
- for _ in 0..len {
- new_tinyvec.push(
- <<A as Array>::Item as borsh::BorshDeserialize>::deserialize_reader(
- reader,
- )?,
- )
- }
-
- Ok(new_tinyvec)
- }
-}
-
-#[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());
- /// ```
- #[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::take(vec);
-
- 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());
- /// ```
- #[inline]
- #[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);
- /// ```
- #[inline]
- 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);
- /// ```
- #[inline]
- #[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);
- /// ```
- #[inline]
- 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);
- /// ```
- #[inline]
- #[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);
- /// ```
- #[inline]
- 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);
- /// ```
- #[inline]
- #[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))
- }
- }
-
- /// Converts a `TinyVec<[T; N]>` into a `Box<[T]>`.
- ///
- /// - For `TinyVec::Heap(Vec<T>)`, it takes the `Vec<T>` and converts it into
- /// a `Box<[T]>` without heap reallocation.
- /// - For `TinyVec::Inline(inner_data)`, it first converts the `inner_data` to
- /// `Vec<T>`, then into a `Box<[T]>`. Requiring only a single heap
- /// allocation.
- ///
- /// ## Example
- ///
- /// ```
- /// use core::mem::size_of_val as mem_size_of;
- /// use tinyvec::TinyVec;
- ///
- /// // Initialize TinyVec with 256 elements (exceeding inline capacity)
- /// let v: TinyVec<[_; 128]> = (0u8..=255).collect();
- ///
- /// assert!(v.is_heap());
- /// assert_eq!(mem_size_of(&v), 136); // mem size of TinyVec<[u8; N]>: N+8
- /// assert_eq!(v.len(), 256);
- ///
- /// let boxed = v.into_boxed_slice();
- /// assert_eq!(mem_size_of(&boxed), 16); // mem size of Box<[u8]>: 16 bytes (fat pointer)
- /// assert_eq!(boxed.len(), 256);
- /// ```
- #[inline]
- #[must_use]
- pub fn into_boxed_slice(self) -> alloc::boxed::Box<[A::Item]> {
- self.into_vec().into_boxed_slice()
- }
-
- /// Converts a `TinyVec<[T; N]>` into a `Vec<T>`.
- ///
- /// `v.into_vec()` is equivalent to `Into::<Vec<_>>::into(v)`.
- ///
- /// - For `TinyVec::Inline(_)`, `.into_vec()` **does not** offer a performance
- /// advantage over `.to_vec()`.
- /// - For `TinyVec::Heap(vec_data)`, `.into_vec()` will take `vec_data`
- /// without heap reallocation.
- ///
- /// ## Example
- ///
- /// ```
- /// use tinyvec::TinyVec;
- ///
- /// let v = TinyVec::from([0u8; 8]);
- /// let v2 = v.clone();
- ///
- /// let vec = v.into_vec();
- /// let vec2: Vec<_> = v2.into();
- ///
- /// assert_eq!(vec, vec2);
- /// ```
- #[inline]
- #[must_use]
- pub fn into_vec(self) -> Vec<A::Item> {
- self.into()
- }
-}
-
-impl<A: Array> TinyVec<A> {
- /// Move all values from `other` into this vec.
- #[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(..)),
- }
- }
-
- 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>(&mut self, acceptable: F) {
- match self {
- TinyVec::Inline(i) => i.retain(acceptable),
- TinyVec::Heap(h) => h.retain(acceptable),
- }
- }
-
- /// Walk the vec and keep only the elements that pass the predicate given,
- /// having the opportunity to modify the elements at the same time.
- ///
- /// ## Example
- ///
- /// ```rust
- /// use tinyvec::*;
- ///
- /// let mut tv = tiny_vec!([i32; 10] => 1, 2, 3, 4);
- /// tv.retain_mut(|x| if *x % 2 == 0 { *x *= 2; true } else { false });
- /// assert_eq!(tv.as_slice(), &[4, 8][..]);
- /// ```
- #[inline]
- #[cfg(feature = "rustc_1_61")]
- pub fn retain_mut<F: FnMut(&mut A::Item) -> bool>(&mut self, acceptable: F) {
- match self {
- TinyVec::Inline(i) => i.retain_mut(acceptable),
- TinyVec::Heap(h) => h.retain_mut(acceptable),
- }
- }
-
- /// Helper for getting the mut slice.
- #[inline(always)]
- #[must_use]
- pub fn as_mut_slice(&mut self) -> &mut [A::Item] {
- self.deref_mut()
- }
-
- /// Helper for getting the shared slice.
- #[inline(always)]
- #[must_use]
- pub fn as_slice(&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 compatibility 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(core::mem::take);
- 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.
- #[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(docsrs, 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>;
-
- #[inline]
- fn nth_back(self: &mut Self, n: usize) -> Option<Self::Item>;
- }
-}
-
-/// Splicing iterator for `TinyVec`
-/// See [`TinyVec::splice`](TinyVec::<A>::splice)
-#[cfg_attr(docsrs, 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>
-{
- #[inline]
- 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> {
- #[inline]
- 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
- }
-}
-
-impl<A: Array> Into<Vec<A::Item>> for TinyVec<A> {
- /// Converts a `TinyVec` into a `Vec`.
- ///
- /// ## Examples
- ///
- /// ### Inline to Vec
- ///
- /// For `TinyVec::Inline(_)`,
- /// `.into()` **does not** offer a performance advantage over `.to_vec()`.
- ///
- /// ```
- /// use core::mem::size_of_val as mem_size_of;
- /// use tinyvec::TinyVec;
- ///
- /// let v = TinyVec::from([0u8; 128]);
- /// assert_eq!(mem_size_of(&v), 136);
- ///
- /// let vec: Vec<_> = v.into();
- /// assert_eq!(mem_size_of(&vec), 24);
- /// ```
- ///
- /// ### Heap into Vec
- ///
- /// For `TinyVec::Heap(vec_data)`,
- /// `.into()` will take `vec_data` without heap reallocation.
- ///
- /// ```
- /// use core::{
- /// any::type_name_of_val as type_of, mem::size_of_val as mem_size_of,
- /// };
- /// use tinyvec::TinyVec;
- ///
- /// const fn from_heap<T: Default>(owned: Vec<T>) -> TinyVec<[T; 1]> {
- /// TinyVec::Heap(owned)
- /// }
- ///
- /// let v = from_heap(vec![0u8; 128]);
- /// assert_eq!(v.len(), 128);
- /// assert_eq!(mem_size_of(&v), 24);
- /// assert!(type_of(&v).ends_with("TinyVec<[u8; 1]>"));
- ///
- /// let vec: Vec<_> = v.into();
- /// assert_eq!(mem_size_of(&vec), 24);
- /// assert!(type_of(&vec).ends_with("Vec<u8>"));
- /// ```
- #[inline]
- #[must_use]
- fn into(self) -> Vec<A::Item> {
- match self {
- Self::Heap(inner) => inner,
- Self::Inline(mut inner) => inner.drain_to_vec(),
- }
- }
-}
-
-/// Iterator for consuming an `TinyVec` and returning owned elements.
-#[cfg_attr(docsrs, 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>;
-
- #[inline]
- fn nth_back(self: &mut Self, n: usize) -> Option<Self::Item>;
- }
-}
-
-impl<A: Array> ExactSizeIterator for TinyVecIterator<A> {
- impl_mirrored! {
- type Mirror = TinyVecIterator;
- #[inline]
- fn len(self: &Self) -> usize;
- }
-}
-
-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() && !self.is_empty() {
- 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() && !self.is_empty() {
- 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)
- }
-}