Skip to main content

Upserted

Struct Upserted 

Source
pub struct Upserted<G: Guard<V>, V: Value> { /* private fields */ }
Expand description

Guard that provides read-only access to both the old and new values of an atomic upsert operation, preventing both from being freed.

Retires the old value on drop, if it existed.

Implementations§

Source§

impl<G, V> Upserted<G, V>
where G: Guard<V>, V: Value,

Source

pub fn old(&self) -> Option<&V::Borrowed>

Return the old value before upserting.

Source

pub fn new(&self) -> &V::Borrowed

Return the new value after upserting.

Trait Implementations§

Source§

impl<G, V> Debug for Upserted<G, V>
where G: Guard<V>, V: Value, V::Borrowed: Debug,

Source§

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

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

impl<G: Guard<V>, V: Value> Drop for Upserted<G, V>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<G, V> Freeze for Upserted<G, V>
where <V as Value>::Guard<G>: Freeze,

§

impl<G, V> RefUnwindSafe for Upserted<G, V>
where <V as Value>::Guard<G>: RefUnwindSafe,

§

impl<G, V> Send for Upserted<G, V>
where <V as Value>::Guard<G>: Send,

§

impl<G, V> Sync for Upserted<G, V>
where <V as Value>::Guard<G>: Sync,

§

impl<G, V> Unpin for Upserted<G, V>
where <V as Value>::Guard<G>: Unpin,

§

impl<G, V> UnsafeUnpin for Upserted<G, V>
where <V as Value>::Guard<G>: UnsafeUnpin,

§

impl<G, V> UnwindSafe for Upserted<G, V>
where <V as Value>::Guard<G>: 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<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

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.