kernel::utilities::cells

Trait 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§