Struct AppendOnlyVec

Source
pub struct AppendOnlyVec<T> { /* private fields */ }

Implementations§

Source§

impl<T> AppendOnlyVec<T>

Source

pub fn iter(&self) -> impl DoubleEndedIterator<Item = &T> + ExactSizeIterator

Return an Iterator over the elements of the vec.

Source

pub fn len(&self) -> usize

Find the length of the array.

Source

pub fn push(&self, val: T) -> usize

Append an element to the array

This is notable in that it doesn’t require a &mut self, because it does appropriate atomic synchronization.

The return value is the index tha was pushed to.

Source

pub fn extend(&self, iter: impl IntoIterator<Item = T>)

Extend the vec with the contents of an iterator.

Note: this is currently no more efficient than calling push for each element of the iterator.

Source

pub fn push_mut(&mut self, val: T) -> usize

Append an element to the array with exclusive access

This is slightly more efficient than AppendOnlyVec::push since it doesn’t need to worry about concurrent access.

The return value is the new size of the array.

Source

pub const fn new() -> Self

Allocate a new empty array

Source

pub fn into_vec(self) -> Vec<T>

Convert into a standard Vec

Trait Implementations§

Source§

impl<T> Debug for AppendOnlyVec<T>
where T: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T> Default for AppendOnlyVec<T>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<T> Drop for AppendOnlyVec<T>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<T> From<Vec<T>> for AppendOnlyVec<T>

Source§

fn from(value: Vec<T>) -> Self

Converts to this type from the input type.
Source§

impl<T> FromIterator<T> for AppendOnlyVec<T>

Source§

fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl<T> Index<usize> for AppendOnlyVec<T>

Source§

type Output = T

The returned type after indexing.
Source§

fn index(&self, idx: usize) -> &Self::Output

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

impl<T> IndexMut<usize> for AppendOnlyVec<T>

Source§

fn index_mut(&mut self, idx: usize) -> &mut Self::Output

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

impl<T> IntoIterator for AppendOnlyVec<T>

Source§

type Item = T

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<T>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<T: Send> Send for AppendOnlyVec<T>

Source§

impl<T: Sync + Send> Sync for AppendOnlyVec<T>

Auto Trait Implementations§

§

impl<T> !Freeze for AppendOnlyVec<T>

§

impl<T> !RefUnwindSafe for AppendOnlyVec<T>

§

impl<T> Unpin for AppendOnlyVec<T>

§

impl<T> UnwindSafe for AppendOnlyVec<T>
where T: RefUnwindSafe,

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.