Skip to main content

Removed

Struct Removed 

Source
pub struct Removed<T: Send + Sync + 'static> { /* private fields */ }
Expand description

A value removed from an Atom or AtomOption.

The value can be read via Deref. When this wrapper is dropped, T’s destructor is deferred through the reclamation system — it will only run once all concurrent readers have moved on.

This prevents use-after-free when concurrent readers hold an AtomGuard that references the same value’s internal heap allocations (e.g. a String’s buffer or Vec’s backing array).

To take ownership without deferral (e.g. when you know no readers exist), use into_inner_unchecked.

Implementations§

Source§

impl<T: Send + Sync + 'static> Removed<T>

Source

pub unsafe fn into_inner_unchecked(self) -> T

Take ownership of the inner value without deferring its destructor.

§Safety

The caller must guarantee no concurrent reader can still access the in-memory copy of this value (e.g. through an AtomGuard obtained before the swap/take).

Trait Implementations§

Source§

impl<T: Send + Sync + 'static + Debug> Debug for Removed<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Send + Sync + 'static> Deref for Removed<T>

Source§

type Target = T

The resulting type after dereferencing.
Source§

fn deref(&self) -> &T

Dereferences the value.
Source§

impl<T: Send + Sync + 'static + Display> Display for Removed<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Send + Sync + 'static> Drop for Removed<T>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<T: Send + Sync + 'static + PartialEq> PartialEq<T> for Removed<T>

Source§

fn eq(&self, other: &T) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: Send + Sync + 'static + PartialEq> PartialEq for Removed<T>

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: Send + Sync + 'static> Send for Removed<T>

Source§

impl<T: Send + Sync + 'static> Sync for Removed<T>

Auto Trait Implementations§

§

impl<T> Freeze for Removed<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Removed<T>
where T: RefUnwindSafe,

§

impl<T> Unpin for Removed<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for Removed<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for Removed<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.