Struct SmallVec

Source
pub struct SmallVec<T: Array, S = Vec<<T as Array>::Item>>(/* private fields */);

Implementations§

Source§

impl<T: Array, S: Vector + Spilled<ArrayVec<T>>> SmallVec<T, S>

Source

pub fn spill(&mut self)

Source

pub fn is_spilled(&self) -> bool

Source§

impl<T: Array, S> SmallVec<T, S>

Source

pub fn into_inner(self) -> Coalesce2<ArrayVec<T>, S>

Trait Implementations§

Source§

impl<'a, T: Array + 'a, S: Vector<Item = T::Item> + 'a> AsRef<dyn Vector<Item = <T as Array>::Item> + 'a> for SmallVec<T, S>
where T::Item: 'a, T::Index: 'a,

Source§

fn as_ref(&self) -> &(dyn Vector<Item = T::Item> + 'a)

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<T: Array, S: Clone> Clone for SmallVec<T, S>
where ArrayVec<T>: Clone,

Source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Array, S: Debug + Vector<Item = T::Item> + Spilled<ArrayVec<T>>> Debug for SmallVec<T, S>
where ArrayVec<T>: Debug,

Source§

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Array, S> Default for SmallVec<T, S>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<T: Array, S: Deref> Deref for SmallVec<T, S>
where ArrayVec<T>: Deref<Target = S::Target>,

Source§

type Target = <S as Deref>::Target

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<T: Array, S: DerefMut> DerefMut for SmallVec<T, S>
where ArrayVec<T>: DerefMut + Deref<Target = S::Target>,

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<T: Array, S: Extend<T::Item>> Extend<<T as Array>::Item> for SmallVec<T, S>
where SmallVec<T, S>: Vector,

Source§

fn extend<I: IntoIterator<Item = T::Item>>(&mut self, iter: I)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<T: Array, S> From<ArrayVec<T>> for SmallVec<T, S>

Source§

fn from(v: ArrayVec<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: Array, S: Extend<T::Item>> FromIterator<<T as Array>::Item> for SmallVec<T, S>
where SmallVec<T, S>: Vector,

Source§

fn from_iter<I: IntoIterator<Item = T::Item>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl<T: Array, S: Hash> Hash for SmallVec<T, S>
where ArrayVec<T>: Hash,

Source§

fn hash<H: Hasher>(&self, h: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T: Array, S: Spilled<ArrayVec<T>> + Index<Range<usize>>> Index<Range<usize>> for SmallVec<T, S>
where ArrayVec<T>: Index<Range<usize>, Output = <S as Index<Range<usize>>>::Output>,

Source§

type Output = <S as Index<Range<usize>>>::Output

The returned type after indexing.
Source§

fn index(&self, index: Range<usize>) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<T: Array, S: Spilled<ArrayVec<T>> + Index<RangeFrom<usize>>> Index<RangeFrom<usize>> for SmallVec<T, S>
where ArrayVec<T>: Index<RangeFrom<usize>, Output = <S as Index<RangeFrom<usize>>>::Output>,

Source§

type Output = <S as Index<RangeFrom<usize>>>::Output

The returned type after indexing.
Source§

fn index(&self, index: RangeFrom<usize>) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<T: Array, S: Spilled<ArrayVec<T>> + Index<RangeFull>> Index<RangeFull> for SmallVec<T, S>
where ArrayVec<T>: Index<RangeFull, Output = <S as Index<RangeFull>>::Output>,

Source§

type Output = <S as Index<RangeFull>>::Output

The returned type after indexing.
Source§

fn index(&self, index: RangeFull) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<T: Array, S: Spilled<ArrayVec<T>> + Index<RangeTo<usize>>> Index<RangeTo<usize>> for SmallVec<T, S>
where ArrayVec<T>: Index<RangeTo<usize>, Output = <S as Index<RangeTo<usize>>>::Output>,

Source§

type Output = <S as Index<RangeTo<usize>>>::Output

The returned type after indexing.
Source§

fn index(&self, index: RangeTo<usize>) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<T: Array, S: Spilled<ArrayVec<T>> + Index<usize>> Index<usize> for SmallVec<T, S>
where ArrayVec<T>: Index<usize, Output = <S as Index<usize>>::Output>,

Source§

type Output = <S as Index<usize>>::Output

The returned type after indexing.
Source§

fn index(&self, index: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<T: Array, S: Spilled<ArrayVec<T>> + IndexMut<Range<usize>>> IndexMut<Range<usize>> for SmallVec<T, S>
where ArrayVec<T>: IndexMut<Range<usize>, Output = <S as Index<Range<usize>>>::Output>,

Source§

fn index_mut(&mut self, index: Range<usize>) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<T: Array, S: Spilled<ArrayVec<T>> + IndexMut<RangeFrom<usize>>> IndexMut<RangeFrom<usize>> for SmallVec<T, S>
where ArrayVec<T>: IndexMut<RangeFrom<usize>, Output = <S as Index<RangeFrom<usize>>>::Output>,

Source§

fn index_mut(&mut self, index: RangeFrom<usize>) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<T: Array, S: Spilled<ArrayVec<T>> + IndexMut<RangeFull>> IndexMut<RangeFull> for SmallVec<T, S>
where ArrayVec<T>: IndexMut<RangeFull, Output = <S as Index<RangeFull>>::Output>,

Source§

fn index_mut(&mut self, index: RangeFull) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<T: Array, S: Spilled<ArrayVec<T>> + IndexMut<RangeTo<usize>>> IndexMut<RangeTo<usize>> for SmallVec<T, S>
where ArrayVec<T>: IndexMut<RangeTo<usize>, Output = <S as Index<RangeTo<usize>>>::Output>,

Source§

fn index_mut(&mut self, index: RangeTo<usize>) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<T: Array, S: Spilled<ArrayVec<T>> + IndexMut<usize>> IndexMut<usize> for SmallVec<T, S>
where ArrayVec<T>: IndexMut<usize, Output = <S as Index<usize>>::Output>,

Source§

fn index_mut(&mut self, index: usize) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<T: Array, S: IntoIterator<Item = <ArrayVec<T> as IntoIterator>::Item>> IntoIterator for SmallVec<T, S>

Source§

type Item = <S as IntoIterator>::Item

The type of the elements being iterated over.
Source§

type IntoIter = SmallVecIter<<ArrayVec<T> as IntoIterator>::IntoIter, <S as IntoIterator>::IntoIter>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<T: Array, S: Vector<Item = T::Item> + Spilled<ArrayVec<T>>> Vector for SmallVec<T, S>

Source§

type Item = <T as Array>::Item

Source§

fn with_capacity(cap: usize) -> Self

Source§

fn capacity(&self) -> usize

Source§

fn reserve(&mut self, additional: usize)

Source§

fn reserve_exact(&mut self, additional: usize)

Source§

fn shrink_to_fit(&mut self)

Source§

fn into_boxed_slice(self) -> Box<[T::Item]>

Source§

unsafe fn set_len(&mut self, len: usize)

Source§

fn len(&self) -> usize

Source§

fn as_ptr(&self) -> *const T::Item

Source§

fn as_mut_ptr(&mut self) -> *mut T::Item

Source§

fn new() -> Self
where Self: Sized,

Source§

fn truncate(&mut self, len: usize)

Source§

fn swap_remove(&mut self, index: usize) -> Self::Item

Source§

fn insert(&mut self, index: usize, element: Self::Item)

Source§

fn remove(&mut self, index: usize) -> Self::Item

Source§

fn retain<F: FnMut(&Self::Item) -> bool>(&mut self, f: F)
where Self: Sized,

Source§

fn push(&mut self, value: Self::Item)

Source§

fn pop(&mut self) -> Option<Self::Item>

Source§

fn clear(&mut self)

Source§

fn is_empty(&self) -> bool

Source§

fn push_cap(&mut self, value: Self::Item) -> Result<(), Self::Item>

Source§

fn insert_cap( &mut self, index: usize, element: Self::Item, ) -> Option<Self::Item>

Source§

fn as_slice(&self) -> &[Self::Item]

Source§

fn as_mut_slice(&mut self) -> &mut [Self::Item]

Source§

unsafe fn uninitialized_resize(&mut self, new_len: usize)

Auto Trait Implementations§

§

impl<T, S> Freeze for SmallVec<T, S>
where S: Freeze, <T as Array>::Index: Freeze, T: Freeze,

§

impl<T, S> RefUnwindSafe for SmallVec<T, S>

§

impl<T, S> Send for SmallVec<T, S>
where S: Send, <T as Array>::Index: Send, T: Send,

§

impl<T, S> Sync for SmallVec<T, S>
where S: Sync, <T as Array>::Index: Sync, T: Sync,

§

impl<T, S> Unpin for SmallVec<T, S>
where S: Unpin, <T as Array>::Index: Unpin, T: Unpin,

§

impl<T, S> UnwindSafe for SmallVec<T, S>
where S: UnwindSafe, <T as Array>::Index: UnwindSafe, T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.