pub struct AsyncShared<T> { /* private fields */ }Expand description
Implementations§
Sourcepub fn try_consume(self) -> Result<T, Self>
pub fn try_consume(self) -> Result<T, Self>
Unwraps the value when this is the last reference, otherwise gives the handle back untouched.
Sourcepub fn read(&self) -> Option<RwLockReadGuard<'_, T>>
pub fn read(&self) -> Option<RwLockReadGuard<'_, T>>
Takes a read lock, blocking until it is free, or returns None when
the lock is poisoned.
Sourcepub fn write(&self) -> Option<RwLockWriteGuard<'_, T>>
pub fn write(&self) -> Option<RwLockWriteGuard<'_, T>>
Takes a write lock, blocking until it is free, or returns None when
the lock is poisoned.
Sourcepub fn swap(&self, data: T) -> Option<T>
pub fn swap(&self, data: T) -> Option<T>
Replaces the value and returns the old one, or None when the lock is
poisoned.
Sourcepub fn references_count(&self) -> usize
pub fn references_count(&self) -> usize
Returns how many handles point at this value.
Returns true when both handles point at the same value.
Trait Implementations§
Source§fn default() -> AsyncShared<T>
fn default() -> AsyncShared<T>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Initialize for Twhere
T: Default,
impl<T> Initialize for Twhere
T: Default,
Source§fn initialize() -> T
fn initialize() -> T
Returns the initial value of this type.