Vendor dependencies for 0.3.0 release

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

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

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

View File

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

View File

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

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

File diff suppressed because it is too large Load Diff

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

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

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

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

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

File diff suppressed because it is too large Load Diff

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

File diff suppressed because it is too large Load Diff