Trait kernel::utilities::cells::NumericCellExt

source ·
pub trait NumericCellExt<T>
where T: Copy + Add + Sub,
{ // Required methods fn add(&self, val: T); fn subtract(&self, val: T); fn increment(&self); fn decrement(&self); fn get_and_increment(&self) -> T; fn get_and_decrement(&self) -> T; }

Required Methods§

source

fn add(&self, val: T)

Add the passed in val to the stored value.

source

fn subtract(&self, val: T)

Subtract the passed in val from the stored value.

source

fn increment(&self)

Add 1 to the stored value.

source

fn decrement(&self)

Subtract 1 from the stored value.

source

fn get_and_increment(&self) -> T

Return the current value and then add 1 to the stored value.

source

fn get_and_decrement(&self) -> T

Return the current value and then subtract 1 from the stored value.

Implementations on Foreign Types§

source§

impl<T> NumericCellExt<T> for Cell<T>
where T: Sub<Output = T> + Add<Output = T> + Copy + From<usize>,

source§

fn add(&self, val: T)

source§

fn subtract(&self, val: T)

source§

fn increment(&self)

source§

fn decrement(&self)

source§

fn get_and_increment(&self) -> T

source§

fn get_and_decrement(&self) -> T

Implementors§