pub trait GuestType: Sized {
// Required methods
fn guest_layout() -> Option<Layout>;
fn read_from_guest(
cpu: &mut CPUState,
ptr: target_ptr_t,
) -> Result<Self, GuestReadFail>;
fn write_to_guest(
&self,
cpu: &mut CPUState,
ptr: target_ptr_t,
) -> Result<(), GuestWriteFail>;
fn read_from_guest_phys(ptr: target_ptr_t) -> Result<Self, GuestReadFail>;
fn write_to_guest_phys(
&self,
ptr: target_ptr_t,
) -> Result<(), GuestWriteFail>;
// Provided methods
fn guest_size() -> Option<usize> { ... }
fn guest_align() -> usize { ... }
}Expand description
A type which can be converted to and from a guest memory representation, allowing
it to be used with GuestPtr.
Required Methods§
fn guest_layout() -> Option<Layout>
fn read_from_guest( cpu: &mut CPUState, ptr: target_ptr_t, ) -> Result<Self, GuestReadFail>
fn write_to_guest( &self, cpu: &mut CPUState, ptr: target_ptr_t, ) -> Result<(), GuestWriteFail>
fn read_from_guest_phys(ptr: target_ptr_t) -> Result<Self, GuestReadFail>
fn write_to_guest_phys(&self, ptr: target_ptr_t) -> Result<(), GuestWriteFail>
Provided Methods§
Sourcefn guest_size() -> Option<usize>
fn guest_size() -> Option<usize>
The size of the type in the guest, None if the type is dynamically sized
Sourcefn guest_align() -> usize
fn guest_align() -> usize
The required minimum alignment of the type in the guest
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.