BaseAppendList

Struct BaseAppendList 

Source
pub struct BaseAppendList<T, V> { /* private fields */ }
Expand description

A list that can be appended to while elements are borrowed

Uses pointer tagging to track allocated chunks of a fixed size.

Indexing is O(1)

Implementations§

Source§

impl<T, V> BaseAppendList<T, V>

Source

pub fn new() -> Self

Source

pub fn get_mut(&mut self, index: usize) -> Option<&mut T>

Get an item from the list, if it is in bounds

Returns None if the index is out-of-bounds. Note that you can also index with [], which will panic on out-of-bounds.

Source

pub fn iter_mut(&mut self) -> IterMut<'_, T>

Get an iterator over the list

Source

pub fn drain_all<'a>(&'a mut self) -> Drain<'a, T>

Source

pub fn len(&self) -> usize

Source

pub fn capacity(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

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

Source§

impl<T> BaseAppendList<T, PushMut>

Source

pub fn push(&self, item: T) -> &mut T

Append an item to the end

Note that this does not require mut.

Source§

impl<T> BaseAppendList<T, Index>

Source

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

Append an item to the end

Note that this does not require mut.

Source

pub fn get<'a>(&'a self, index: usize) -> Option<&'a T>

Get an item from the list, if it is in bounds

Returns None if the index is out-of-bounds. Note that you can also index with [], which will panic on out-of-bounds.

Source

pub fn iter(&self) -> Iter<'_, T>

Get an iterator over the list

Trait Implementations§

Source§

impl<T: Debug> Debug for BaseAppendList<T, Index>

Source§

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

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

impl<T, V> Default for BaseAppendList<T, V>

Source§

fn default() -> Self

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

impl<T, V> Extend<T> for BaseAppendList<T, V>

Source§

fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<T, V> FromIterator<T> for BaseAppendList<T, V>

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 BaseAppendList<T, Index>

Source§

type Output = T

The returned type after indexing.
Source§

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

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

impl<'a, T> IntoIterator for &'a BaseAppendList<T, Index>

Source§

type Item = &'a T

The type of the elements being iterated over.
Source§

type IntoIter = Iter<'a, 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: PartialEq> PartialEq for BaseAppendList<T, Index>

Source§

fn eq(&self, other: &BaseAppendList<T, Index>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

§

impl<T, V> !Freeze for BaseAppendList<T, V>

§

impl<T, V> !RefUnwindSafe for BaseAppendList<T, V>

§

impl<T, V> !Send for BaseAppendList<T, V>

§

impl<T, V> !Sync for BaseAppendList<T, V>

§

impl<T, V> Unpin for BaseAppendList<T, V>
where V: Unpin,

§

impl<T, V> UnwindSafe for BaseAppendList<T, V>

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.