pub trait GuestMemoryView<'a> {
type Reader: MemoryRead;
type Writer: MemoryWrite;
// Required methods
fn reader(self, mem: &'a GuestMemory) -> Self::Reader;
fn writer(self, mem: &'a GuestMemory) -> Self::Writer;
}Expand description
Adapter trait attaching a GuestMemory backing to a range descriptor to
produce byte-oriented readers and writers.
This trait is the extension point that lets PagedRange and
PagedRanges — which by themselves are pure address-space descriptors
with no attached memory — be read from or written to. It is implemented for
both range types in this module and is not intended to be implemented by
downstream crates.
The typical call pattern is:
ⓘ
use guestmem::MemoryRead;
use guestmem::ranges::GuestMemoryView;
let mut reader = range.reader(&mem);
let value: MyStruct = reader.read_plain()?;Required Associated Types§
Sourcetype Reader: MemoryRead
type Reader: MemoryRead
The MemoryRead implementation type
Sourcetype Writer: MemoryWrite
type Writer: MemoryWrite
The MemoryWrite implementation type
Required Methods§
Sourcefn reader(self, mem: &'a GuestMemory) -> Self::Reader
fn reader(self, mem: &'a GuestMemory) -> Self::Reader
Returns a MemoryRead implementation for the ranges.
Sourcefn writer(self, mem: &'a GuestMemory) -> Self::Writer
fn writer(self, mem: &'a GuestMemory) -> Self::Writer
Returns a MemoryWrite implementation for the ranges.