Trait cvar::Variable [] [src]

pub trait Variable<T> where T: Debug {
    fn get(&self) -> T;
    fn set(&self, val: T);
    fn with<R, F>(&self, f: F) -> R where F: FnOnce(&T) -> R;
}

Abstraction over interior mutability.

Required Methods

fn get(&self) -> T

Gets a clone of the value.

fn set(&self, val: T)

Sets a new value.

fn with<R, F>(&self, f: F) -> R where F: FnOnce(&T) -> R

Work with the value without a potentially expensive clone.

Implementors