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 = Allocator;
#[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
Trait Implementations
sourceimpl<T: Default + VSafe + Ord + Copy, A: MemPool> Ord for VCell<T, A>
impl<T: Default + VSafe + Ord + Copy, A: MemPool> Ord for VCell<T, A>
sourceimpl<T: Default + VSafe + PartialEq + Copy, A: MemPool> PartialEq<VCell<T, A>> for VCell<T, A>
impl<T: Default + VSafe + PartialEq + Copy, A: MemPool> PartialEq<VCell<T, A>> for VCell<T, A>
sourceimpl<T: Default + VSafe + PartialOrd + Copy, A: MemPool> PartialOrd<T> for VCell<T, A>
impl<T: Default + VSafe + PartialOrd + Copy, A: MemPool> PartialOrd<T> for VCell<T, A>
sourcefn partial_cmp(&self, other: &T) -> Option<Ordering>
fn partial_cmp(&self, other: &T) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn lt(&self, other: &T) -> bool
fn lt(&self, other: &T) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn le(&self, other: &T) -> bool
fn le(&self, other: &T) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<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>
sourcefn partial_cmp(&self, other: &VCell<T, A>) -> Option<Ordering>
fn partial_cmp(&self, other: &VCell<T, A>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn lt(&self, other: &VCell<T, A>) -> bool
fn lt(&self, other: &VCell<T, A>) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn le(&self, other: &VCell<T, A>) -> bool
fn le(&self, other: &VCell<T, A>) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl<T: Default + VSafe + Eq + Copy, A: MemPool> Eq for VCell<T, A>
impl<T: Default + VSafe + ?Sized, A: MemPool> PSafe for VCell<T, A>
impl<T: Default + VSafe + ?Sized, A: MemPool> Send for VCell<T, A>
Safe to transfer between thread boundaries
impl<T, A: MemPool> !Sync for VCell<T, A>
Not safe for thread data sharing
Auto Trait Implementations
impl<T, A> LooseTxInUnsafe for VCell<T, A> where
T: LooseTxInUnsafe,
impl<T, A> PSend for VCell<T, A> where
A: PSend,
T: PSend,
impl<T, A> RefUnwindSafe for VCell<T, A> where
T: RefUnwindSafe,
impl<T, A> TxInSafe for VCell<T, A> where
T: TxInSafe,
impl<T, A> TxOutSafe for VCell<T, A> where
A: TxOutSafe,
T: TxOutSafe,
impl<T, A> Unpin for VCell<T, A> where
A: Unpin,
T: Unpin,
impl<T, A> UnwindSafe for VCell<T, A> where
T: UnwindSafe,
impl<T, A> VSafe for VCell<T, A> where
A: VSafe,
Blanket Implementations
sourceimpl<T, P> Allocatable<T, P> for T where
T: Default,
P: MemPool,
impl<T, P> Allocatable<T, P> for T where
T: Default,
P: MemPool,
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more