Struct option_lock::OptionLock [−][src]
pub struct OptionLock<T> { /* fields omitted */ }
Expand description
A read/write lock around an Option
value.
Implementations
impl<T> OptionLock<T>
[src]
impl<T> OptionLock<T>
[src]pub fn is_none_unlocked(&self) -> bool
[src]
pub fn is_none_unlocked(&self) -> bool
[src]Check if there is no stored value and no guard held.
pub fn is_some_unlocked(&self) -> bool
[src]
pub fn is_some_unlocked(&self) -> bool
[src]Check if there is a stored value and no guard held.
pub fn get_mut(&mut self) -> Option<&mut T>
[src]
pub fn get_mut(&mut self) -> Option<&mut T>
[src]Get a mutable reference to the contained value, if any.
pub fn into_inner(self) -> Option<T>
[src]
pub fn into_inner(self) -> Option<T>
[src]Unwrap an owned lock instance.
pub fn spin_get(&self) -> MutexGuard<'_, T>
[src]
pub fn spin_get(&self) -> MutexGuard<'_, T>
[src]In a spin loop, wait to get an exclusive lock on the contained value.
pub fn spin_lock(&self) -> OptionGuard<'_, T>
[src]
pub fn spin_lock(&self) -> OptionGuard<'_, T>
[src]In a spin loop, wait to acquire the lock.
pub fn spin_lock_none(&self) -> OptionGuard<'_, T>
[src]
pub fn spin_lock_none(&self) -> OptionGuard<'_, T>
[src]In a spin loop, wait to acquire the lock with an empty slot.
pub fn try_get(&self) -> Result<MutexGuard<'_, T>, OptionLockError>
[src]
pub fn try_get(&self) -> Result<MutexGuard<'_, T>, OptionLockError>
[src]Try to acquire an exclusive lock around a contained value.
On successful acquisition a MutexGuard<'_, T>
is returned, representing
an exclusive read/write lock.
pub fn try_get_arc(
self: &Arc<Self>
) -> Result<MutexGuardArc<T>, OptionLockError>
[src]
pub fn try_get_arc(
self: &Arc<Self>
) -> Result<MutexGuardArc<T>, OptionLockError>
[src]Try to acquire an exclusive lock around the value in an Arc<OptionLock>
.
On successful acquisition a MutexGuardArc<T>
is returned, representing
an exclusive read/write lock.
pub fn try_fill(&self, value: T) -> Result<(), T>
[src]
pub fn try_fill(&self, value: T) -> Result<(), T>
[src]Try to store a value, if the slot is currently empty and a lock can be acquired.
pub fn try_fill_with(
&self,
f: impl FnOnce() -> T
) -> Result<(), OptionLockError>
[src]
pub fn try_fill_with(
&self,
f: impl FnOnce() -> T
) -> Result<(), OptionLockError>
[src]Store the result of an initializer function if the slot is currently empty and a lock can be acquired. If a lock cannot be acquired, then the initializer is never called.
pub fn try_lock(&self) -> Result<OptionGuard<'_, T>, OptionLockError>
[src]
pub fn try_lock(&self) -> Result<OptionGuard<'_, T>, OptionLockError>
[src]Try to acquire an exclusive lock.
On successful acquisition an OptionGuard<'_, T>
is returned, representing
an exclusive read/write lock.
pub fn try_lock_arc(
self: &Arc<Self>
) -> Result<OptionGuardArc<T>, OptionLockError>
[src]
pub fn try_lock_arc(
self: &Arc<Self>
) -> Result<OptionGuardArc<T>, OptionLockError>
[src]Try to acquire an exclusive lock from a reference to an Arc<OptionLock>
.
On successful acquisition an OptionGuardArc<T>
is returned, representing
an exclusive read/write lock.
pub fn try_lock_none(&self) -> Result<OptionGuard<'_, T>, OptionLockError>
[src]
pub fn try_lock_none(&self) -> Result<OptionGuard<'_, T>, OptionLockError>
[src]Try to acquire an exclusive lock when there is no value currently stored.
pub fn try_lock_empty_arc(
self: &Arc<Self>
) -> Result<OptionGuardArc<T>, OptionLockError>
[src]
pub fn try_lock_empty_arc(
self: &Arc<Self>
) -> Result<OptionGuardArc<T>, OptionLockError>
[src]Try to acquire an exclusive lock when there is no value currently stored.
pub fn try_take(&self) -> Result<T, OptionLockError>
[src]
pub fn try_take(&self) -> Result<T, OptionLockError>
[src]Try to take a stored value from the lock.
impl<T: Clone> OptionLock<T>
[src]
impl<T: Clone> OptionLock<T>
[src]pub fn try_clone(&self) -> Result<T, OptionLockError>
[src]
pub fn try_clone(&self) -> Result<T, OptionLockError>
[src]Try to clone the contained resource.
impl<T: Copy> OptionLock<T>
[src]
impl<T: Copy> OptionLock<T>
[src]pub fn try_copy(&self) -> Result<T, OptionLockError>
[src]
pub fn try_copy(&self) -> Result<T, OptionLockError>
[src]Try to copy the contained resource.
Trait Implementations
impl<T> Debug for OptionLock<T>
[src]
impl<T> Debug for OptionLock<T>
[src]impl<T> Default for OptionLock<T>
[src]
impl<T> Default for OptionLock<T>
[src]impl<T> Drop for OptionLock<T>
[src]
impl<T> Drop for OptionLock<T>
[src]impl<T> From<Option<T>> for OptionLock<T>
[src]
impl<T> From<Option<T>> for OptionLock<T>
[src]impl<T> From<OptionLock<T>> for OnceCell<T>
[src]
impl<T> From<OptionLock<T>> for OnceCell<T>
[src]fn from(lock: OptionLock<T>) -> Self
[src]
fn from(lock: OptionLock<T>) -> Self
[src]Performs the conversion.
impl<T> From<T> for OptionLock<T>
[src]
impl<T> From<T> for OptionLock<T>
[src]impl<T> Into<Option<T>> for OptionLock<T>
[src]
impl<T> Into<Option<T>> for OptionLock<T>
[src]impl<T: Send> Send for OptionLock<T>
[src]
impl<T: Send> Sync for OptionLock<T>
[src]
Auto Trait Implementations
impl<T> !RefUnwindSafe for OptionLock<T>
impl<T> Unpin for OptionLock<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for OptionLock<T> where
T: UnwindSafe,
T: UnwindSafe,