mapped_vec

Struct MappedVec

Source
pub struct MappedVec<T> { /* private fields */ }
Expand description

See the crate-level documentation for the description of this structure, which is all of the public API in this crate, as well as the method documentation for more info.

Implementations§

Source§

impl<T> MappedVec<T>

Source

pub fn new() -> MappedVec<T>

This creates a new mapped vector.

Source

pub fn append(&mut self, v: &mut MappedVec<T>)

This appends a mapped vector to this one.

Source

pub fn len(&self) -> usize

This gets the length of a mapped vector.

Source

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

This adds an element to a mapped vector.

Source

pub fn swap(&mut self, x: usize, y: usize)

This quickly swaps elements of the vector.

Source

pub fn pop(&mut self)

This quickly pops off an element of the vector.

Source

pub fn remove(&mut self, index: usize)

This quickly removes an element of the vector.

Source

pub fn insert(&mut self, index: usize, value: T)

This quickly inserts an element into an index of the vector.

Source

pub fn reverse(&mut self)

This quickly reverses the vector.

Source

pub fn rotate(&mut self, offs: isize)

This quickly rotates the vector’s elements.

Source

pub fn clear(&mut self)

This clears the vector.

Source

pub fn resize_with<F: Fn() -> T>(&mut self, nl: usize, f: F)

This resizes a vector to a specific size. If the size exceeds the length of the vector, then the remaining elements are filled in by a specified closure.

Source

pub fn swap_remove(&mut self, index: usize)

This removes an element without caring about ordering.

Source

pub fn is_empty(&self) -> bool

This checks if the vector is empty.

Source

pub fn update_vector(&mut self)

This changes the layout of the vector and resets the indices while maintaining the same indexing behavior.

Source

pub fn extend<I: Iterator<Item = T> + Clone>(&mut self, iterator: I)

This extends the vector by an iterator.

Source

pub fn get_mapped(&self) -> Vec<&T>

This gets an ordered vector of references to the elements of this vector.

Source§

impl<T: Clone> MappedVec<T>

Source

pub fn extend_from_slice(&mut self, input: &[T])

This extends the vector.

Source

pub fn to_vec(&self) -> Vec<T>

This is an expensive operation that turns this mapped vector into a regular one. It is recommended to use get_mapped whenever possible over this.

Source

pub fn resize(&mut self, nl: usize, v: T)

This resizes the vector. If the size is large than the current size, then the remaining elements are turned into a specified value.

Trait Implementations§

Source§

impl<T> Index<usize> for MappedVec<T>

Source§

type Output = T

The returned type after indexing.
Source§

fn index(&self, index: usize) -> &T

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

impl<T> IndexMut<usize> for MappedVec<T>

Source§

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

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

Auto Trait Implementations§

§

impl<T> Freeze for MappedVec<T>

§

impl<T> RefUnwindSafe for MappedVec<T>
where T: RefUnwindSafe,

§

impl<T> Send for MappedVec<T>
where T: Send,

§

impl<T> Sync for MappedVec<T>
where T: Sync,

§

impl<T> Unpin for MappedVec<T>
where T: Unpin,

§

impl<T> UnwindSafe for MappedVec<T>
where 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> 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<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.