pub struct Vect<T, S>where
S: Size,{ /* private fields */ }
Expand description
The type-safe vector with type-level length.
Implementations§
Source§impl<T> Vect<T, Dyn>
impl<T> Vect<T, Dyn>
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Creates an empty vector with dynamic length and with specified capacity.
Source§impl<T, S> Vect<T, S>where
S: Size,
impl<T, S> Vect<T, S>where
S: Size,
Sourcepub fn push(self, elem: T) -> PushImplOp<Self, T>
pub fn push(self, elem: T) -> PushImplOp<Self, T>
Appends an element to the end of the vector.
Sourcepub fn get<'a, I>(&'a self, index: I) -> GetImplOp<'a, Self, I::Output>
pub fn get<'a, I>(&'a self, index: I) -> GetImplOp<'a, Self, I::Output>
Returns a reference to an element depending on the index.
If both length and index have static sizes, it returns &T
. Otherwise, it returns Option<&T>
.
Sourcepub fn insert<I>(self, index: I, elem: T) -> InsertImplOp<Self, I::Output, T>
pub fn insert<I>(self, index: I, elem: T) -> InsertImplOp<Self, I::Output, T>
Inserts an element at specified index.
If both length and index have static sizes, it checks if the index is valid in compile time. Otherwise, it panics if the index is out of bound.
Sourcepub fn remove<I>(self, index: I) -> RemoveImplOp<Self, I::Output>
pub fn remove<I>(self, index: I) -> RemoveImplOp<Self, I::Output>
Removes an element at specified index.
If both length and index have static sizes, it checks if the index is valid in compile time. Otherwise, it panics if the index is out of bound.
Trait Implementations§
Source§impl<'a, T, S, Index> GetImpl<'a, Vect<T, S>, Index> for ()where
S: Size,
Index: Size,
(): GetPrivate<'a, Vect<T, S>, Index, CheckIndexOp<S, Index>> + CheckIndex<S, Index>,
impl<'a, T, S, Index> GetImpl<'a, Vect<T, S>, Index> for ()where
S: Size,
Index: Size,
(): GetPrivate<'a, Vect<T, S>, Index, CheckIndexOp<S, Index>> + CheckIndex<S, Index>,
Source§impl<S, Index, Item> InsertImpl<Vect<Item, S>, Index, Item> for ()
impl<S, Index, Item> InsertImpl<Vect<Item, S>, Index, Item> for ()
Source§impl<T: Ord, S> Ord for Vect<T, S>
impl<T: Ord, S> Ord for Vect<T, S>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<T: PartialOrd, S> PartialOrd for Vect<T, S>where
S: Size + PartialOrd,
impl<T: PartialOrd, S> PartialOrd for Vect<T, S>where
S: Size + PartialOrd,
Source§impl<__TYP_GENERIC_0, __TYP_GENERIC_1> Pop<Vect<__TYP_GENERIC_0, __TYP_GENERIC_1>> for ()where
(): DecreaseOne<__TYP_GENERIC_1> + __TYP_MatchArm_0<__TYP_GENERIC_0, __TYP_GENERIC_1, <() as DecreaseOne<__TYP_GENERIC_1>>::Output>,
Vect<__TYP_GENERIC_0, __TYP_GENERIC_1>:,
__TYP_GENERIC_0:,
__TYP_GENERIC_1: Size,
impl<__TYP_GENERIC_0, __TYP_GENERIC_1> Pop<Vect<__TYP_GENERIC_0, __TYP_GENERIC_1>> for ()where
(): DecreaseOne<__TYP_GENERIC_1> + __TYP_MatchArm_0<__TYP_GENERIC_0, __TYP_GENERIC_1, <() as DecreaseOne<__TYP_GENERIC_1>>::Output>,
Vect<__TYP_GENERIC_0, __TYP_GENERIC_1>:,
__TYP_GENERIC_0:,
__TYP_GENERIC_1: Size,
Source§impl<__TYP_GENERIC_0, __TYP_GENERIC_1> Push<Vect<__TYP_GENERIC_0, __TYP_GENERIC_1>> for ()where
__TYP_GENERIC_0:,
<() as IncreaseOne<__TYP_GENERIC_1>>::Output: Size,
Vect<__TYP_GENERIC_0, __TYP_GENERIC_1>:,
__TYP_GENERIC_1: Size,
(): IncreaseOne<__TYP_GENERIC_1>,
impl<__TYP_GENERIC_0, __TYP_GENERIC_1> Push<Vect<__TYP_GENERIC_0, __TYP_GENERIC_1>> for ()where
__TYP_GENERIC_0:,
<() as IncreaseOne<__TYP_GENERIC_1>>::Output: Size,
Vect<__TYP_GENERIC_0, __TYP_GENERIC_1>:,
__TYP_GENERIC_1: Size,
(): IncreaseOne<__TYP_GENERIC_1>,
Source§impl<S, Index, Item> RemoveImpl<Vect<Item, S>, Index> for ()
impl<S, Index, Item> RemoveImpl<Vect<Item, S>, Index> for ()
Source§impl<T, S> VectFactory<T> for Vect<T, S>where
S: Size,
impl<T, S> VectFactory<T> for Vect<T, S>where
S: Size,
impl<T: Eq, S> Eq for Vect<T, S>
impl<T, S> StructuralPartialEq for Vect<T, S>where
S: Size,
Auto Trait Implementations§
impl<T, S> Freeze for Vect<T, S>
impl<T, S> RefUnwindSafe for Vect<T, S>where
S: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, S> Send for Vect<T, S>
impl<T, S> Sync for Vect<T, S>
impl<T, S> Unpin for Vect<T, S>
impl<T, S> UnwindSafe for Vect<T, S>where
S: UnwindSafe,
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more