GuestPtr

Struct GuestPtr 

Source
pub struct GuestPtr<T: ?Sized + Pointee> { /* private fields */ }

Implementations§

Source§

impl<T: ?Sized + Pointee> GuestPtr<T>

Source

pub fn new(pointer: T::Pointer) -> Self

Source

pub fn offset(&self) -> T::Pointer

Source

pub fn cast<U>(&self) -> GuestPtr<U>
where U: Pointee<Pointer = T::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.

Source

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.

Source

pub fn as_array(&self, elems: u32) -> GuestPtr<[T]>
where T: GuestType + Pointee<Pointer = u32>,

Returns a GuestPtr for an array of Ts using this pointer as the base.

Source§

impl<T> GuestPtr<[T]>

Source

pub fn offset_base(&self) -> u32

Source

pub fn len(&self) -> u32

Source

pub fn iter( &self, ) -> impl ExactSizeIterator<Item = Result<GuestPtr<T>, GuestError>> + '_
where T: GuestType,

Source

pub fn as_ptr(&self) -> GuestPtr<T>

Source§

impl GuestPtr<str>

Source

pub fn as_bytes(&self) -> GuestPtr<[u8]>

Trait Implementations§

Source§

impl<T: Clone + ?Sized + Pointee> Clone for GuestPtr<T>
where T::Pointer: Clone,

Source§

fn clone(&self) -> GuestPtr<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: PartialEq + ?Sized + Pointee> PartialEq for GuestPtr<T>
where T::Pointer: PartialEq,

Source§

fn eq(&self, other: &GuestPtr<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: Copy + ?Sized + Pointee> Copy for GuestPtr<T>
where T::Pointer: Copy,

Source§

impl<T: ?Sized + Pointee> StructuralPartialEq for GuestPtr<T>

Auto Trait Implementations§

§

impl<T> Freeze for GuestPtr<T>
where <T as Pointee>::Pointer: Freeze, T: ?Sized,

§

impl<T> RefUnwindSafe for GuestPtr<T>
where <T as Pointee>::Pointer: RefUnwindSafe, T: ?Sized,

§

impl<T> Send for GuestPtr<T>
where <T as Pointee>::Pointer: Send, T: ?Sized,

§

impl<T> Sync for GuestPtr<T>
where <T as Pointee>::Pointer: Sync, T: ?Sized,

§

impl<T> Unpin for GuestPtr<T>
where <T as Pointee>::Pointer: Unpin, T: ?Sized,

§

impl<T> UnwindSafe for GuestPtr<T>
where <T as Pointee>::Pointer: UnwindSafe, T: ?Sized,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointee for T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.