[][src]Struct atomic_destroy::AtomicDestroy

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

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]

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

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.