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]
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]
&'a self,
guard: MutexGuard<'a, ()>
) -> LockedWrite<'a, T>
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> Default for SyncPushVec<T>
[src]impl<T> Drop for SyncPushVec<T>
[src]
impl<T> Drop for SyncPushVec<T>
[src]impl<T: Clone + Send> FromIterator<T> for SyncPushVec<T>
[src]
impl<T: Clone + Send> FromIterator<T> for SyncPushVec<T>
[src]fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
[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,
T: Unpin,