aztec-nr - std::collections::vec

Struct Vec

pub struct Vec<T>
{ /* private fields */ }

Implementations

impl<T> Vec<T>

pub fn new() -> Self pub fn from_slice(slice: [T]) -> Self pub fn get(self, index: u32) -> T

Get an element from the vector at the given index. Panics if the given index points beyond the end of the vector.

pub fn set(&mut self, index: u32, value: T)

Write an element to the vector at the given index. Panics if the given index points beyond the end of the vector (self.len()).

pub fn push(&mut self, elem: T)

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

pub fn pop(&mut self) -> T

Pop an element from the end of the given vector, returning a new vector with a length of one less than the given vector, as well as the popped element. Panics if the given vector's length is zero.

pub fn insert(&mut self, index: u32, elem: T)

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

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

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

pub fn len(self) -> u32

Returns the number of elements in the vector