Struct dirty::Dirty
[−]
[src]
pub struct Dirty<T> { /* fields omitted */ }
Dirty wraps a value of type T with functions similiar to that of a Read/Write lock but simply sets a dirty flag on write(), reset on clear(). Use read() or deref (*dirty_variable) to access the inner value.
Methods
impl<T> Dirty<T>
[src]
pub fn new(val: T) -> Dirty<T>
[src]
Create a new Dirty.
pub fn dirty(&self) -> bool
[src]
Returns true if dirty, false otherwise.
pub fn write(&mut self) -> &mut T
[src]
Writable value return, sets the dirty flag.
pub fn read(&self) -> &T
[src]
Read the value.
pub fn clear(&mut self)
[src]
Clears the dirty flag.
pub fn read_dirty(&self) -> Option<&T>
[src]
Read the value only if modified since last read.
Trait Implementations
impl<T> Deref for Dirty<T>
[src]
type Target = T
The resulting type after dereferencing.
fn deref(&self) -> &T
[src]
Dereferences the value.
impl<T> Default for Dirty<T> where
T: Default,
[src]
T: Default,