Trait VmIoOnce

Source
pub trait VmIoOnce {
    // Required methods
    fn read_once<T: PodOnce>(&self, offset: usize) -> Result<T>;
    fn write_once<T: PodOnce>(&self, offset: usize, new_val: &T) -> Result<()>;
}
Expand description

A trait that enables reading/writing data from/to a VM object using one non-tearing memory load/store.

See also VmIo, which enables reading/writing data from/to a VM object without the guarantee of using one non-tearing memory load/store.

Required Methods§

Source

fn read_once<T: PodOnce>(&self, offset: usize) -> Result<T>

Reads a value of the PodOnce type at the specified offset using one non-tearing memory load.

Except that the offset is specified explicitly, the semantics of this method is the same as VmReader::read_once.

Source

fn write_once<T: PodOnce>(&self, offset: usize, new_val: &T) -> Result<()>

Writes a value of the PodOnce type at the specified offset using one non-tearing memory store.

Except that the offset is specified explicitly, the semantics of this method is the same as VmWriter::write_once.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§