aztec-nr - std

Primitive type slice

Implementations

impl<T> [T]

pub fn len(self) -> u32

Returns the length of the slice.

pub fn push_back(self, elem: T) -> Self

Push a new element to the end of the slice, returning a new slice with a length one greater than the original unmodified slice.

pub fn push_front(self, elem: T) -> Self

Push a new element to the front of the slice, returning a new slice with a length one greater than the original unmodified slice.

pub fn pop_back(self) -> (Self, T)

Remove the last element of the slice, returning the popped slice and the element in a tuple

pub fn pop_front(self) -> (T, Self)

Remove the first element of the slice, returning the element and the popped slice in a tuple

pub fn insert(self, index: u32, elem: T) -> Self

Insert an element at a specified index, shifting all elements after it to the right

pub fn remove(self, index: u32) -> (Self, T)

Remove an element at a specified index, shifting all elements after it to the left, returning the altered slice and the removed element

pub fn append(self, other: Self) -> Self

Append each element of the other slice to the end of self. This returns a new slice and leaves both input slices unchanged.

pub fn as_array<let N: u32>(self) -> [T; N] pub fn map<U, Env>(self, f: fn[Env](T) -> U) -> [U] pub fn mapi<U, Env>(self, f: fn[Env](u32, T) -> U) -> [U] pub fn for_each<Env>(self, f: fn[Env](T)) pub fn for_eachi<Env>(self, f: fn[Env](u32, T)) pub fn fold<U, Env>(self, accumulator: U, f: fn[Env](U, T) -> U) -> U pub fn reduce<Env>(self, f: fn[Env](T, T) -> T) -> T pub fn filter<Env>(self, predicate: fn[Env](T) -> bool) -> Self pub fn join(self, separator: T) -> T
where T: Append
pub fn all<Env>(self, predicate: fn[Env](T) -> bool) -> bool pub fn any<Env>(self, predicate: fn[Env](T) -> bool) -> bool