beefeater

Struct Beefeater

Source
pub struct Beefeater<T: Copy>(/* private fields */);
Expand description

A generic guard around any type that implements Copy, which allows an object to be safely shared between threads.

Implementations§

Source§

impl<T: Copy> Beefeater<T>

Source

pub fn new(value: T) -> Beefeater<T>

Creates a new Beefeater.

Source

pub fn load(&self) -> T

Loads the current value from the Beefeater.

Source

pub fn store(&self, val: T)

Stores a new value into the Beefeater.

Source

pub fn swap(&self, val: T) -> T

Store a new value into the Beefeater, returning the old value.

Trait Implementations§

Source§

impl<Lhs, Rhs> AddAssign<Rhs> for Beefeater<Lhs>
where Lhs: AddAssign<Rhs> + Copy,

Source§

fn add_assign(&self, val: Rhs)

Add to the current value, storing the result.
Source§

impl<T: Copy + Debug> Debug for Beefeater<T>

Source§

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

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

impl<T: Copy + Default> Default for Beefeater<T>

Source§

fn default() -> Self

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

impl<Lhs, Rhs> FetchAdd<Lhs, Rhs> for Beefeater<Lhs>
where Lhs: AddAssign<Rhs> + Copy,

Source§

fn fetch_add(&self, val: Rhs) -> Lhs

Add to the current value, returning the previous value.
Source§

impl<Lhs, Rhs> FetchSub<Lhs, Rhs> for Beefeater<Lhs>
where Lhs: SubAssign<Rhs> + Copy,

Source§

fn fetch_sub(&self, val: Rhs) -> Lhs

Subtract from the current value, returning the previous value.
Source§

impl<Lhs, Rhs> SubAssign<Rhs> for Beefeater<Lhs>
where Lhs: SubAssign<Rhs> + Copy,

Source§

fn sub_assign(&self, val: Rhs)

Subtract from the current value, storing the result.
Source§

impl<T: Copy + Send> Sync for Beefeater<T>

Auto Trait Implementations§

§

impl<T> !Freeze for Beefeater<T>

§

impl<T> RefUnwindSafe for Beefeater<T>

§

impl<T> Send for Beefeater<T>
where T: Send,

§

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

§

impl<T> UnwindSafe for Beefeater<T>

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.