[][src]Struct crndm::cell::VCell

pub struct VCell<T: Default + VSafe + ?Sized, A: MemPool> { /* fields omitted */ }

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 crndm::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();
     
P::transaction(|j| {
    let mut v = root.v.borrow_mut();
    assert_eq!(*v, i32::default());
    *v = 20; // This value is volatile and resets on restart
}).unwrap();

Implementations

impl<T: Default + VSafe, A: MemPool> VCell<T, A>[src]

pub fn new(v: T) -> Self[src]

Trait Implementations

impl<T: Default + VSafe, A: MemPool> Default for VCell<T, A>[src]

impl<T: Default + VSafe, A: MemPool> Deref for VCell<T, A>[src]

type Target = T

The resulting type after dereferencing.

impl<T: Default + VSafe, A: MemPool> DerefMut for VCell<T, A>[src]

impl<T: Default + VSafe + ?Sized, A: MemPool> Drop for VCell<T, A>[src]

impl<T: Default + VSafe + Eq + Copy, A: MemPool> Eq for VCell<T, A>[src]

impl<T: Default + VSafe + Ord + Copy, A: MemPool> Ord for VCell<T, A>[src]

impl<T: Default + VSafe + ?Sized, A: MemPool> PSafe for VCell<T, A>[src]

impl<T: Default + VSafe + PartialEq + Copy, A: MemPool> PartialEq<T> for VCell<T, A>[src]

impl<T: Default + VSafe + PartialEq + Copy, A: MemPool> PartialEq<VCell<T, A>> for VCell<T, A>[src]

impl<T: Default + VSafe + PartialOrd + Copy, A: MemPool> PartialOrd<T> for VCell<T, A>[src]

impl<T: Default + VSafe + PartialOrd + Copy, A: MemPool> PartialOrd<VCell<T, A>> for VCell<T, A>[src]

impl<T: Default + VSafe + ?Sized, A: MemPool> Send for VCell<T, A>[src]

Safe to transfer between thread boundaries

impl<T, A: MemPool> !Sync for VCell<T, A>[src]

Not safe for thread data sharing

Auto Trait Implementations

impl<T, A> LooseTxInUnsafe for VCell<T, A> where
    A: LooseTxInUnsafe,
    T: LooseTxInUnsafe
[src]

impl<T, A> RefUnwindSafe for VCell<T, A> where
    A: RefUnwindSafe,
    T: RefUnwindSafe
[src]

impl<T, A> !TxInSafe for VCell<T, A>[src]

impl<T, A> !TxOutSafe for VCell<T, A>[src]

impl<T, A> Unpin for VCell<T, A> where
    A: Unpin,
    T: Unpin
[src]

impl<T, A> UnwindSafe for VCell<T, A> where
    A: UnwindSafe,
    T: RefUnwindSafe + UnwindSafe
[src]

impl<T, A> VSafe for VCell<T, A> where
    A: VSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,