pub type IovecArray = GuestPtr<[Iovec]>;
preview1
only.Aliased Type§
struct IovecArray { /* private fields */ }
Implementations
§impl<T> GuestPtr<[T]>
impl<T> GuestPtr<[T]>
pub fn offset_base(&self) -> u32
pub fn offset_base(&self) -> u32
For slices, specifically returns the relative pointer to the base of the array.
This is similar to <[T]>::as_ptr()
pub fn iter(&self) -> impl ExactSizeIteratorwhere
T: GuestType,
pub fn iter(&self) -> impl ExactSizeIteratorwhere
T: GuestType,
Returns an iterator over interior pointers.
Each item is a Result
indicating whether it overflowed past the end of
the address space or not.
pub fn as_ptr(&self) -> GuestPtr<T>
pub fn as_ptr(&self) -> GuestPtr<T>
Returns a GuestPtr
pointing to the base of the array for the interior
type T
.
pub fn get(&self, index: u32) -> Option<GuestPtr<T>>where
T: GuestType,
pub fn get_range(&self, r: Range<u32>) -> Option<GuestPtr<[T]>>where
T: GuestType,
§impl<T> GuestPtr<T>where
T: Pointee + ?Sized,
impl<T> GuestPtr<T>where
T: Pointee + ?Sized,
pub fn new(pointer: <T as Pointee>::Pointer) -> GuestPtr<T>
pub fn new(pointer: <T as Pointee>::Pointer) -> GuestPtr<T>
Creates a new GuestPtr
from the given mem
and pointer
values.
Note that for sized types like u32
, GuestPtr<T>
, etc, the pointer
value is a u32
offset into guest memory. For slices and strings,
pointer
is a (u32, u32)
offset/length pair.
pub fn offset(&self) -> <T as Pointee>::Pointer
pub fn offset(&self) -> <T as Pointee>::Pointer
Returns the offset of this pointer in guest memory.
Note that for sized types this returns a u32
, but for slices and
strings it returns a (u32, u32)
pointer/length pair.
pub fn cast<U>(&self) -> GuestPtr<U>where
U: Pointee<Pointer = <T as Pointee>::Pointer> + ?Sized,
pub fn cast<U>(&self) -> GuestPtr<U>where
U: Pointee<Pointer = <T as Pointee>::Pointer> + ?Sized,
Casts this GuestPtr
type to a different type.
This is a safe method which is useful for simply reinterpreting the type
parameter on this GuestPtr
. Note that this is a safe method, where
again there’s no guarantees about alignment, validity, in-bounds-ness,
etc of the returned pointer.
pub fn add(&self, amt: u32) -> Result<GuestPtr<T>, GuestError>where
T: GuestType + Pointee<Pointer = u32>,
pub fn add(&self, amt: u32) -> Result<GuestPtr<T>, GuestError>where
T: GuestType + Pointee<Pointer = u32>,
Performs pointer arithmetic on this pointer, moving the pointer forward
amt
slots.
This will either return the resulting pointer or Err
if the pointer
arithmetic calculation would overflow around the end of the address
space.