GuestType

Trait GuestType 

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

Provided Methods§

Source

fn guest_size() -> Option<usize>

The size of the type in the guest, None if the type is dynamically sized

Source

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.

Implementations on Foreign Types§

Source§

impl GuestType for f32

Source§

impl GuestType for f64

Source§

impl GuestType for i8

Source§

impl GuestType for i16

Source§

impl GuestType for i32

Source§

impl GuestType for i64

Source§

impl GuestType for i128

Source§

impl GuestType for u8

Source§

impl GuestType for u16

Source§

impl GuestType for u32

Source§

impl GuestType for u64

Source§

impl GuestType for u128

Source§

impl<T: GuestType, const N: usize> GuestType for [T; N]

Implementors§