[go: up one dir, main page]

pub struct AtomicPtr<T>(_);
Expand description

Mock implementation of std::sync::atomic::AtomicPtr.

NOTE: Unlike std::sync::atomic::AtomicPtr, this type has a different in-memory representation than *mut T.

Implementations

Creates a new instance of AtomicPtr.

Load the value without any synchronization.

Safety

An unsynchronized atomic load technically always has undefined behavior. However, if the atomic value is not currently visible by other threads, this should always be equivalent to a non-atomic load of an un-shared *mut T value.

Get access to a mutable reference to the inner value.

Loads a value from the pointer.

Stores a value into the pointer.

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

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

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

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

Fetches the value, and applies a function to it that returns an optional new value. Returns a Result of Ok(previous_value) if the function returned Some(_), else Err(previous_value).

Trait Implementations

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Converts to this type from the input type.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more