Struct horde::sync_push_vec::SyncPushVec[][src]

pub struct SyncPushVec<T> { /* fields omitted */ }

A contiguous push-only array type with lock-free reads.

Implementations

impl<T> SyncPushVec<T>[src]

pub fn new() -> Self[src]

Constructs a new, empty vector with zero capacity.

The vector will not allocate until elements are pushed onto it.

pub fn with_capacity(capacity: usize) -> Self[src]

Constructs a new, empty vector with the specified capacity.

The vector will be able to hold exactly capacity elements without reallocating. If capacity is 0, the vector will not allocate.

pub fn mutex(&self) -> &Mutex<()>[src]

Gets a reference to the underlying mutex that protects writes.

pub fn read<'a>(&'a self, pin: Pin<'a>) -> Read<'a, T>[src]

Creates a Read handle from a pinned region.

Use crate::collect::pin to get a Pin instance.

pub unsafe fn unsafe_write(&self) -> Write<'_, T>[src]

Creates a Write handle without checking for exclusive access.

Safety

It’s up to the caller to ensure only one thread writes to the vector at a time.

pub fn write(&mut self) -> Write<'_, T>[src]

Creates a Write handle from a mutable reference.

pub fn lock(&self) -> LockedWrite<'_, T>[src]

Creates a LockedWrite handle by taking the underlying mutex that protects writes.

pub fn lock_from_guard<'a>(
    &'a self,
    guard: MutexGuard<'a, ()>
) -> LockedWrite<'a, T>
[src]

Creates a LockedWrite handle from a guard protecting the underlying mutex that protects writes.

pub fn as_mut_slice(&mut self) -> &mut [T][src]

Extracts a mutable slice of the entire vector.

Trait Implementations

impl<T> Default for SyncPushVec<T>[src]

impl<T> Drop for SyncPushVec<T>[src]

impl<T: Clone + Send> FromIterator<T> for SyncPushVec<T>[src]

impl<T: Send> Send for SyncPushVec<T>[src]

impl<T: Sync> Sync for SyncPushVec<T>[src]

Auto Trait Implementations

impl<T> !RefUnwindSafe for SyncPushVec<T>

impl<T> Unpin for SyncPushVec<T> where
    T: Unpin

impl<T> !UnwindSafe for SyncPushVec<T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.