Struct vm_memory::volatile_memory::VolatileRef [−][src]
pub struct VolatileRef<'a, T, B = ()> { /* fields omitted */ }
Expand description
A memory location that supports volatile access to an instance of T.
Examples
let mut v = 5u32; let v_ref = unsafe { VolatileRef::new(&mut v as *mut u32 as *mut u8) }; assert_eq!(v, 5); assert_eq!(v_ref.load(), 5); v_ref.store(500); assert_eq!(v, 500);
Implementations
Creates a VolatileRef to an instance of T.
Safety
To use this safely, the caller must guarantee that the memory at addr is big enough for a
T and is available for the duration of the lifetime of the new VolatileRef. The caller
must also guarantee that all other users of the given chunk of memory are using volatile
accesses.
Creates a VolatileRef to an instance of T, using the
provided bitmap object for dirty page tracking.
Safety
To use this safely, the caller must guarantee that the memory at addr is big enough for a
T and is available for the duration of the lifetime of the new VolatileRef. The caller
must also guarantee that all other users of the given chunk of memory are using volatile
accesses.
Gets the size of the referenced type T.
Examples
let v_ref = unsafe { VolatileRef::<u32>::new(0 as *mut _) }; assert_eq!(v_ref.len(), size_of::<u32>() as usize);
Converts this to a VolatileSlice with the same size and
address.
Trait Implementations
Auto Trait Implementations
impl<'a, T, B> RefUnwindSafe for VolatileRef<'a, T, B> where
B: RefUnwindSafe,
T: RefUnwindSafe,
impl<'a, T, B = ()> !Send for VolatileRef<'a, T, B>
impl<'a, T, B = ()> !Sync for VolatileRef<'a, T, B>
impl<'a, T, B> Unpin for VolatileRef<'a, T, B> where
B: Unpin,
impl<'a, T, B> UnwindSafe for VolatileRef<'a, T, B> where
B: UnwindSafe,
T: RefUnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more