pub struct UserInOutPtr<T> { /* private fields */ }Expand description
A wrapper around a mutable pointer to user memory (read-write).
Implementations§
Source§impl<T> UserInOutPtr<T>
impl<T> UserInOutPtr<T>
Sourcepub fn byte_offset(&self, count: isize) -> Self
pub fn byte_offset(&self, count: isize) -> Self
Returns a pointer offset by count bytes.
Sourcepub fn element_offset(&self, index: usize) -> Self
pub fn element_offset(&self, index: usize) -> Self
Returns a pointer offset by index elements.
Sourcepub fn reinterpret<U>(&self) -> UserInOutPtr<U>
pub fn reinterpret<U>(&self) -> UserInOutPtr<U>
Reinterprets the pointer as a pointer to type U.
Sourcepub const fn as_in_ptr(&self) -> UserInPtr<T>
pub const fn as_in_ptr(&self) -> UserInPtr<T>
Returns a UserInPtr viewing the same user memory.
Sourcepub const fn as_out_ptr(&self) -> UserOutPtr<T>
pub const fn as_out_ptr(&self) -> UserOutPtr<T>
Returns a UserOutPtr viewing the same user memory.
Sourcepub fn copy_from_user<'a>(
&self,
dst: &'a mut MaybeUninit<T>,
) -> Result<&'a mut T, Status>
pub fn copy_from_user<'a>( &self, dst: &'a mut MaybeUninit<T>, ) -> Result<&'a mut T, Status>
Copies a single element from userspace into dst.
Sourcepub fn read(&self) -> Result<T, Status>
pub fn read(&self) -> Result<T, Status>
Reads and returns a single copyable element from userspace.
Sourcepub fn copy_slice_from_user<'a>(
&self,
dst: &'a mut [MaybeUninit<T>],
) -> Result<&'a mut [T], Status>
pub fn copy_slice_from_user<'a>( &self, dst: &'a mut [MaybeUninit<T>], ) -> Result<&'a mut [T], Status>
Copies a slice of elements from userspace into dst.
Sourcepub fn copy_to_user(&self, src: &T) -> Result<(), Status>
pub fn copy_to_user(&self, src: &T) -> Result<(), Status>
Copies a single element from src to userspace.
Sourcepub fn copy_slice_to_user(&self, src: &[T]) -> Result<(), Status>
pub fn copy_slice_to_user(&self, src: &[T]) -> Result<(), Status>
Copies a slice of elements from src to userspace.
Trait Implementations§
Source§impl<T: Clone> Clone for UserInOutPtr<T>
impl<T: Clone> Clone for UserInOutPtr<T>
Source§fn clone(&self) -> UserInOutPtr<T>
fn clone(&self) -> UserInOutPtr<T>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable)§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T: Debug> Debug for UserInOutPtr<T>
impl<T: Debug> Debug for UserInOutPtr<T>
Source§impl<T: Default> Default for UserInOutPtr<T>
impl<T: Default> Default for UserInOutPtr<T>
Source§fn default() -> UserInOutPtr<T>
fn default() -> UserInOutPtr<T>
Returns the “default value” for a type. Read more
impl<T: Copy> Copy for UserInOutPtr<T>
Auto Trait Implementations§
impl<T> Freeze for UserInOutPtr<T>
impl<T> RefUnwindSafe for UserInOutPtr<T>where
T: RefUnwindSafe,
impl<T> !Send for UserInOutPtr<T>
impl<T> !Sync for UserInOutPtr<T>
impl<T> Unpin for UserInOutPtr<T>
impl<T> UnsafeUnpin for UserInOutPtr<T>
impl<T> UnwindSafe for UserInOutPtr<T>where
T: RefUnwindSafe,
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)