AVec

Struct AVec 

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

Vector supporting multiple non-overlapping writers or multiple readers. Blocks during resizes only. !todo panics on concurrent reads+writes

Implementations§

Source§

impl<T> AVec<T>

Source

pub fn new(initial_capacity: usize) -> AVec<T>

Creates a new instance with given inital capacity

Source

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

Adds an element to the vector and returns the insert position.

Source

pub fn map<'a>(&'a self, size: usize) -> AVecMapGuard<'a, T>

Maps a slice of the vector for write access. Faster than individual pushes for size > 2.

Source

pub fn len(&self) -> usize

Returns the current length of the vector.

Source

pub fn grow(&self, required_capacity: usize)

Grow vector by given number of elements.

Source

pub fn clear(&self)

Clears the vector.

Source

pub fn get<'a>(&'a self) -> AVecReadGuard<'a, T>

Maps the entire vector for read access.

Source

pub fn capacity(&self) -> usize

Returns current capacity. The vector will reallocate once this is exceeded.

Trait Implementations§

Source§

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

Provides debug formatting for T that implement fmt::Debug

Source§

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

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

impl<'a, T> Drop for AVec<T>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<T> Send for AVec<T>

Source§

impl<T> Sync for AVec<T>

Auto Trait Implementations§

§

impl<T> !Freeze for AVec<T>

§

impl<T> !RefUnwindSafe for AVec<T>

§

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

§

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