[−][src]Struct atomic_destroy::AtomicDestroy
An atomically destroyable value.
Implementations
impl<T> AtomicDestroy<T>
[src]
#[must_use]pub const fn new(value: T) -> Self
[src]
Create a new atomically destroyable value.
#[must_use]pub const fn empty() -> Self
[src]
Create an atomically destroyable value that has already been dropped.
#[must_use]pub fn maybe_new(value: Option<T>) -> Self
[src]
Create an atomically destroyable value from an Option<T>
.
pub fn get(&self) -> Option<Value<T, &Self>>
[src]
Get the value if it hasn't been destroyed.
pub fn with<R>(&self, f: impl FnOnce(&T) -> R) -> Option<R>
[src]
Run a function using the value.
pub fn destroy(&self)
[src]
Destroy the value. If someone is currently using the value the destructor will be run when they are done.
Trait Implementations
impl<T: Clone> Clone for AtomicDestroy<T>
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T: Debug> Debug for AtomicDestroy<T>
[src]
impl<T> Drop for AtomicDestroy<T>
[src]
impl<T: Send + Sync> Send for AtomicDestroy<T>
[src]
impl<T: Send + Sync> Sync for AtomicDestroy<T>
[src]
Auto Trait Implementations
impl<T> Unpin for AtomicDestroy<T> where
T: Unpin,
T: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,