[][src]Struct type_vec::vect::Vect

pub struct Vect<T, S> where
    S: Size
{ /* fields omitted */ }

The type-safe vector with type-level length.

Implementations

impl<T> Vect<T, U0>[src]

pub fn new() -> Self[src]

Creates an empty vector with static length.

pub fn with_capacity(capacity: usize) -> Self[src]

Creates an empty vector with static length and with specified capacity.

pub fn len(&self) -> usize[src]

Gets the number of elements.

impl<T> Vect<T, Dyn>[src]

pub fn new() -> Self[src]

Creates an empty vector with dynamic length.

pub fn from_vec(data: Vec<T>) -> Self[src]

Creates a vector from Vec.

pub fn with_capacity(capacity: usize) -> Self[src]

Creates an empty vector with dynamic length and with specified capacity.

pub fn len(&self) -> usize[src]

Gets the number of elements.

pub fn into_static<S>(self) -> Option<Vect<T, S>> where
    S: Unsigned + Size
[src]

Converts a vector with static length.

The vector size must be equal to the specified static size. Otherwise it returns None.

impl<T, U, B> Vect<T, UInt<U, B>> where
    U: Unsigned,
    B: Bit
[src]

pub fn len(&self) -> usize[src]

Gets the number of elements.

impl<T, S> Vect<T, S> where
    S: Size
[src]

pub fn push(self, elem: T) -> PushImplOp<Self, T> where
    (): PushImpl<Self, T>, 
[src]

Appends an element to the end of the vector.

pub fn pop(self) -> PopImplOp<Self> where
    (): PopImpl<Self>, 
[src]

Removes an element from the end of the vector.

pub fn get<'a, I>(&'a self, index: I) -> GetImplOp<'a, Self, I::Output> where
    I: IntoSize,
    (): GetImpl<'a, Self, I::Output>, 
[src]

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>.

pub fn insert<I>(self, index: I, elem: T) -> InsertImplOp<Self, I::Output, T> where
    I: IntoSize,
    (): InsertImpl<Self, I::Output, T>, 
[src]

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.

pub fn remove<I>(self, index: I) -> RemoveImplOp<Self, I::Output> where
    I: IntoSize,
    (): RemoveImpl<Self, I::Output>, 
[src]

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.

pub fn into_dyn(self) -> Vect<T, Dyn>[src]

Converts to a vector with dynamic length type.

pub fn into_vec(self) -> Vec<T>[src]

Converts to Vec.

Trait Implementations

impl<T: Clone, S: Clone> Clone for Vect<T, S> where
    S: Size
[src]

impl<T: Debug, S: Debug> Debug for Vect<T, S> where
    S: Size
[src]

impl<T: Eq, S: Eq> Eq for Vect<T, S> where
    S: Size
[src]

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>, 
[src]

type Output = <() as GetPrivate<'a, Vect<T, S>, Index, CheckIndexOp<S, Index>>>::Output

impl<T: Hash, S: Hash> Hash for Vect<T, S> where
    S: Size
[src]

impl<S, Index, Item> InsertImpl<Vect<Item, S>, Index, Item> for () where
    S: Size,
    Index: Size,
    (): IncreaseOne<S> + CheckIndexInclusive<S, Index>, 
[src]

type Output = Vect<Item, IncreaseOneOp<S>>

impl<T: Ord, S: Ord> Ord for Vect<T, S> where
    S: Size
[src]

impl<T: PartialEq, S: PartialEq> PartialEq<Vect<T, S>> for Vect<T, S> where
    S: Size
[src]

impl<T: PartialOrd, S: PartialOrd> PartialOrd<Vect<T, S>> for Vect<T, S> where
    S: Size
[src]

impl<__TYP_GENERIC_0, __TYP_GENERIC_1> Pop<Vect<__TYP_GENERIC_0, __TYP_GENERIC_1>> for () where
    __TYP_GENERIC_1: Size,
    __TYP_GENERIC_0: ,
    (): __TYP_MatchArm_0<__TYP_GENERIC_0, __TYP_GENERIC_1, <() as DecreaseOne<__TYP_GENERIC_1>>::Output> + DecreaseOne<__TYP_GENERIC_1>,
    Vect<__TYP_GENERIC_0, __TYP_GENERIC_1>: , 
[src]

type Output = <() as __TYP_MatchArm_0<__TYP_GENERIC_0, __TYP_GENERIC_1, <() as DecreaseOne<__TYP_GENERIC_1>>::Output>>::Output

impl<__TYP_GENERIC_0, __TYP_GENERIC_1> Push<Vect<__TYP_GENERIC_0, __TYP_GENERIC_1>> for () where
    (): IncreaseOne<__TYP_GENERIC_1>,
    __TYP_GENERIC_1: Size,
    __TYP_GENERIC_0: ,
    Vect<__TYP_GENERIC_0, __TYP_GENERIC_1>: ,
    <() as IncreaseOne<__TYP_GENERIC_1>>::Output: Size
[src]

type Output = Vect<__TYP_GENERIC_0, <() as IncreaseOne<__TYP_GENERIC_1>>::Output>

impl<T, S> PushImpl<Vect<T, S>, T> for () where
    S: Size,
    (): Push<Vect<T, S>>,
    PushOp<Vect<T, S>>: VectFactory<T>, 
[src]

type Output = PushOp<Vect<T, S>>

impl<S, Index, Item> RemoveImpl<Vect<Item, S>, Index> for () where
    S: Size,
    Index: Size,
    (): DecreaseOne<S> + CheckIndex<S, Index>, 
[src]

type Output = (Vect<Item, DecreaseOneOp<S>>, Item)

impl<T, S> StructuralEq for Vect<T, S> where
    S: Size
[src]

impl<T, S> StructuralPartialEq for Vect<T, S> where
    S: Size
[src]

impl<T, S> VectFactory<T> for Vect<T, S> where
    S: Size
[src]

Auto Trait Implementations

impl<T, S> RefUnwindSafe for Vect<T, S> where
    S: RefUnwindSafe,
    T: RefUnwindSafe

impl<T, S> Send for Vect<T, S> where
    S: Send,
    T: Send

impl<T, S> Sync for Vect<T, S> where
    S: Sync,
    T: Sync

impl<T, S> Unpin for Vect<T, S> where
    S: Unpin,
    T: Unpin

impl<T, S> UnwindSafe for Vect<T, S> where
    S: UnwindSafe,
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.