[][src]Trait radium::RadiumBool

pub trait RadiumBool {
    fn new(v: bool) -> Self;
fn fence(order: Ordering);
fn get_mut(&mut self) -> &mut bool;
fn into_inner(self) -> bool;
fn load(&self, order: Ordering) -> bool;
fn store(&self, val: bool, order: Ordering);
fn swap(&self, val: bool, order: Ordering) -> bool;
fn compare_and_swap(
        &self,
        current: bool,
        new: bool,
        order: Ordering
    ) -> bool;
fn compare_exchange(
        &self,
        current: bool,
        new: bool,
        success: Ordering,
        failure: Ordering
    ) -> Result<bool, bool>;
fn compare_exchange_weak(
        &self,
        current: bool,
        new: bool,
        success: Ordering,
        failure: Ordering
    ) -> Result<bool, bool>;
fn fetch_and(&self, val: bool, order: Ordering) -> bool;
fn fetch_nand(&self, val: bool, order: Ordering) -> bool;
fn fetch_or(&self, val: bool, order: Ordering) -> bool;
fn fetch_xor(&self, val: bool, order: Ordering) -> bool; }

A maybe-atomic shared mutable bool.

This trait is implemented by both AtomicBool and Cell<bool>, providing a consistent interface for interacting with the two types.

Required methods

fn new(v: bool) -> Self

Creates a new value of this type.

fn fence(order: Ordering)

If the underlying value is atomic, calls fence with the given Ordering. Otherwise, does nothing.

See also: fence

fn get_mut(&mut self) -> &mut bool

Returns a mutable reference to the underlying value.

This is safe because the mutable reference guarantees that no other references exist to this value.

fn into_inner(self) -> bool

Consumes and returns the contained value.

This is safe as passing by value ensures no other references exist.

fn load(&self, order: Ordering) -> bool

Load a value from this object.

Ordering arguments are ignored by non-atomic types.

See also: AtomicBool::load

fn store(&self, val: bool, order: Ordering)

Store a value in this object.

Ordering arguments are ignored by non-atomic types.

See also: AtomicBool::store

fn swap(&self, val: bool, order: Ordering) -> bool

Swap with the value stored in this object.

Ordering arguments are ignored by non-atomic types.

See also: AtomicBool::swap

fn compare_and_swap(&self, current: bool, new: bool, order: Ordering) -> bool

Stores a value into this object if the current value is the same as the current value.

The return value is always the previous value. If it is equal to current, then the value was updated.

Ordering arguments are ignored by non-atomic types.

See also: AtomicBool::compare_and_swap

fn compare_exchange(
    &self,
    current: bool,
    new: bool,
    success: Ordering,
    failure: Ordering
) -> Result<bool, bool>

Stores a value into this object if the current value is the same as the current value.

The return value is a result indicating whether the new value was written and containing the previous value. On success this value is guaranteed to be equal to current.

Ordering arguments are ignored by non-atomic types.

See also: AtomicBool::compare_exchange

fn compare_exchange_weak(
    &self,
    current: bool,
    new: bool,
    success: Ordering,
    failure: Ordering
) -> Result<bool, bool>

Stores a value into this object if the current value is the same as the current value.

Unlike compare_exchange, this function is allowed to spuriously fail even when the comparison succeeds, which can result in more efficient code on some platforms. The return value is a result indicating whether the new value was written and containing the previous value.

Ordering arguments are ignored by non-atomic types.

See also: AtomicBool::compare_exchange_weak

fn fetch_and(&self, val: bool, order: Ordering) -> bool

Performs a bitwise "and" on the current value and the argument val, snd sets the new value to the result.

Returns the previous value.

Ordering arguments are ignored by non-atomic types.

See also: AtomicBool::fetch_and

fn fetch_nand(&self, val: bool, order: Ordering) -> bool

Performs a bitwise "nand" on the current value and the argument val, snd sets the new value to the result.

Returns the previous value.

Ordering arguments are ignored by non-atomic types.

See also: AtomicBool::fetch_nand

fn fetch_or(&self, val: bool, order: Ordering) -> bool

Performs a bitwise "or" on the current value and the argument val, snd sets the new value to the result.

Returns the previous value.

Ordering arguments are ignored by non-atomic types.

See also: AtomicBool::fetch_or

fn fetch_xor(&self, val: bool, order: Ordering) -> bool

Performs a bitwise "xor" on the current value and the argument val, snd sets the new value to the result.

Returns the previous value.

Ordering arguments are ignored by non-atomic types.

See also: AtomicBool::fetch_xor

Loading content...

Implementations on Foreign Types

impl RadiumBool for AtomicBool[src]

impl RadiumBool for Cell<bool>[src]

Loading content...

Implementors

Loading content...