Skip to main content

UserOutPtr

Struct UserOutPtr 

Source
pub struct UserOutPtr<T> { /* private fields */ }
Expand description

A wrapper around a mutable pointer to user memory (write-only).

Implementations§

Source§

impl<T> UserOutPtr<T>

Source

pub const fn new(ptr: *mut T) -> Self

Constructs a new UserOutPtr.

Source

pub fn is_null(&self) -> bool

Returns true if the underlying pointer is null.

Source

pub fn as_ptr(&self) -> *mut T

Returns the underlying raw pointer.

Source

pub fn byte_offset(&self, count: isize) -> Self

Returns a pointer offset by count bytes.

Source

pub fn element_offset(&self, index: usize) -> Self

Returns a pointer offset by index elements.

Source

pub fn reinterpret<U>(&self) -> UserOutPtr<U>

Reinterprets the pointer as a pointer to type U.

Source

pub fn copy_to_user(&self, src: &T) -> Result<(), Status>
where T: IntoBytes + Immutable,

Copies a single element from src to userspace.

Source

pub fn write(&self, val: T) -> Result<(), Status>
where T: IntoBytes + Immutable,

Writes a single copyable value to userspace.

Source

pub fn copy_slice_to_user(&self, src: &[T]) -> Result<(), Status>
where T: IntoBytes + Immutable,

Copies a slice of elements from src to userspace.

Trait Implementations§

Source§

impl<T: Clone> Clone for UserOutPtr<T>

Source§

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

Returns a duplicate of the value. Read more
1.0.0 (const: unstable)§

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

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for UserOutPtr<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Default> Default for UserOutPtr<T>

Source§

fn default() -> UserOutPtr<T>

Returns the “default value” for a type. Read more
Source§

impl<T: Copy> Copy for UserOutPtr<T>

Auto Trait Implementations§

§

impl<T> Freeze for UserOutPtr<T>

§

impl<T> RefUnwindSafe for UserOutPtr<T>
where T: RefUnwindSafe,

§

impl<T> !Send for UserOutPtr<T>

§

impl<T> !Sync for UserOutPtr<T>

§

impl<T> Unpin for UserOutPtr<T>

§

impl<T> UnsafeUnpin for UserOutPtr<T>

§

impl<T> UnwindSafe for UserOutPtr<T>
where T: RefUnwindSafe,

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

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

§

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
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.