Struct AtomicFallbackPtr

Source
pub struct AtomicFallbackPtr<T> { /* private fields */ }
Available on doc only.
Expand description

An example fallback implementation of an atomic pointer.

AtomicPtr points to a type like this when no built-in atomic pointer is available.

This type is the pointer version of AtomicFallback; see its documentation for more details. Like AtomicFallback, this type is exposed only in the documentation for illustrative purposes.

Implementations§

Source§

impl<T> AtomicFallbackPtr<T>

Source

pub const fn new(v: *mut T) -> Self

Creates a new atomic.

See atomic::AtomicPtr::new.

Source

pub fn get_mut(&mut self) -> &mut *mut T

Returns a mutable reference to the underlying value.

See atomic::AtomicPtr::get_mut.

Source

pub fn into_inner(self) -> *mut T

Consumes the atomic and returns the contained value.

See atomic::AtomicPtr::into_inner.

Source

pub fn load(&self, order: Ordering) -> *mut T

Loads a value from the atomic.

See atomic::AtomicPtr::load.

Source

pub fn store(&self, val: *mut T, order: Ordering)

Stores a value into the atomic.

See atomic::AtomicPtr::store.

Source

pub fn swap(&self, val: *mut T, order: Ordering) -> *mut T

Stores a value into the atomic, returning the previous value.

See atomic::AtomicPtr::swap.

Source

pub fn compare_and_swap( &self, current: *mut T, new: *mut T, order: Ordering, ) -> *mut T

Stores a value into the atomic if the current value is the same as the current value.

See atomic::AtomicPtr::compare_and_swap.

Source

pub fn compare_exchange( &self, current: *mut T, new: *mut T, success: Ordering, failure: Ordering, ) -> Result<*mut T, *mut T>

Stores a value into the atomic if the current value is the same as the current value.

See atomic::AtomicPtr::compare_exchange.

Source

pub fn compare_exchange_weak( &self, current: *mut T, new: *mut T, success: Ordering, failure: Ordering, ) -> Result<*mut T, *mut T>

Stores a value into the atomic if the current value is the same as the current value.

See atomic::AtomicPtr::compare_exchange_weak.

Source

pub fn fetch_update<F>( &self, set_order: Ordering, fetch_order: Ordering, f: F, ) -> Result<*mut T, *mut T>
where F: FnMut(*mut T) -> Option<*mut T>,

Fetches the value, and applies a function to it that returns an optional new value.

See atomic::AtomicPtr::fetch_update.

Source

pub const fn as_ptr(&self) -> *mut *mut T

Returns a mutable pointer to the underlying value.

See atomic::AtomicPtr::as_ptr.

Trait Implementations§

Auto Trait Implementations§

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, 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.