Struct corundum::cell::VCell [−][src]
Expand description
A persistent memory location containing a volatile data
The underlying data is valid throughout of the course of a single pool
lifetime. When the pool is reopened, the data is back to its default value.
Type T
in VCell<T>
should implement Default
and VSafe
.
Examples
use corundum::default::*; use std::cell::RefCell; type P = BuddyAlloc; #[derive(Default)] struct Root { v: VCell<RefCell<i32>> } let root = P::open::<Root>("foo.pool", O_CF).unwrap(); let mut v = root.v.borrow_mut(); assert_eq!(*v, i32::default()); *v = 20; // This value is volatile and resets on restart assert_eq!(*v, 20);
Implementations
Create a new invalid cell to be used in const functions
Invalidates the underlying value
Trait Implementations
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
impl<T: Default + VSafe + PartialOrd + Copy, A: MemPool> PartialOrd<VCell<T, A>> for VCell<T, A>
impl<T: Default + VSafe + PartialOrd + Copy, A: MemPool> PartialOrd<VCell<T, A>> for VCell<T, A>
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Safe to transfer between thread boundaries
Not safe for thread data sharing