pub struct GuestPtr<T: GuestType> { /* private fields */ }Implementations§
Source§impl<T: GuestType> GuestPtr<T>
impl<T: GuestType> GuestPtr<T>
Sourcepub fn read(&self) -> Result<&T, GuestReadFail>
pub fn read(&self) -> Result<&T, GuestReadFail>
Reads the value from the guest to be accessed later. This is a no-op if a value has already been cached. This is only needed if you need to read at a different time than you intend to.
If you want read a value and replace the cache if it exists, use
GuestPtr::update instead. If you wish to read at time of first access,
the GuestPtr only needs to be dereferenced without calling read ahead of
time.
Sourcepub fn clear_cache(&mut self)
pub fn clear_cache(&mut self)
Clear the cached value, if any exists.
Sourcepub fn get_cached(&self) -> Option<&T>
pub fn get_cached(&self) -> Option<&T>
Returns a reference to the cached value if one exists.
Sourcepub fn offset(&self, off: usize) -> Self
pub fn offset(&self, off: usize) -> Self
Creates a copy of the pointer offset by N items.
Note: Similar to normal pointer arithmatic the actual value of the offset will be multiplied by the size of the object.
Sourcepub fn offset_bytes(&self, bytes: usize) -> Self
pub fn offset_bytes(&self, bytes: usize) -> Self
Creates a copy of the pointer offset by N bytes.
Trait Implementations§
Source§impl<T: GuestType> From<u64> for GuestPtr<T>
impl<T: GuestType> From<u64> for GuestPtr<T>
Source§fn from(pointer: target_ptr_t) -> Self
fn from(pointer: target_ptr_t) -> Self
Converts to this type from the input type.
Source§impl<T: GuestType> GuestType for GuestPtr<T>
impl<T: GuestType> GuestType for GuestPtr<T>
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>
Source§fn guest_size() -> Option<usize>
fn guest_size() -> Option<usize>
The size of the type in the guest,
None if the type is dynamically sizedSource§fn guest_align() -> usize
fn guest_align() -> usize
The required minimum alignment of the type in the guest
Auto Trait Implementations§
impl<T> !Freeze for GuestPtr<T>
impl<T> RefUnwindSafe for GuestPtr<T>where
T: UnwindSafe + RefUnwindSafe,
impl<T> Send for GuestPtr<T>where
T: Send,
impl<T> Sync for GuestPtr<T>
impl<T> Unpin for GuestPtr<T>
impl<T> UnwindSafe for GuestPtr<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more