Struct AtomicReloadId

Source
pub struct AtomicReloadId(/* private fields */);
Expand description

A ReloadId that can be shared between threads.

This type is useful when one cannot afford the associated lifetime of ReloadWatcher and is cheaper than a Mutex<ReloadId>.

update method is enough to satisfy most needs, but this type exposes more primitive operations too.

Implementations§

Source§

impl AtomicReloadId

Source

pub const fn new() -> Self

Creates a new atomic ReloadId.

Source

pub const fn with_value(value: ReloadId) -> Self

Creates a new atomic ReloadId, initialized with the given value.

Source

pub fn update(&self, new: ReloadId) -> bool

Updates self if the argument if the argument is newer. Returns true if self was updated.

Source

pub fn load(&self) -> ReloadId

Loads the inner ReloadId.

Source

pub fn store(&self, new: ReloadId)

Stores a ReloadId.

Source

pub fn swap(&self, new: ReloadId) -> ReloadId

Stores a ReloadId, returning the previous one.

Source

pub fn fetch_max(&self, new: ReloadId) -> ReloadId

Stores the maximum of the two ReloadId, returning the previous one.

Trait Implementations§

Source§

impl Debug for AtomicReloadId

Source§

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

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

impl Default for AtomicReloadId

Source§

fn default() -> Self

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

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.
Source§

impl<T> Storable for T
where T: Send + Sync + 'static,