Skip to main content

GuestMemoryView

Trait GuestMemoryView 

Source
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§

Source

type Reader: MemoryRead

The MemoryRead implementation type

Source

type Writer: MemoryWrite

The MemoryWrite implementation type

Required Methods§

Source

fn reader(self, mem: &'a GuestMemory) -> Self::Reader

Returns a MemoryRead implementation for the ranges.

Source

fn writer(self, mem: &'a GuestMemory) -> Self::Writer

Returns a MemoryWrite implementation for the ranges.

Implementors§