Struct syscall_encode::ptr::UserPointer
source · pub struct UserPointer<'abi, T> { /* private fields */ }Expand description
A type representing a user pointer.
Implementations§
source§impl<'abi, T> UserPointer<'abi, T>
impl<'abi, T> UserPointer<'abi, T>
sourcepub fn new(ptr: &'abi T) -> UserPointer<'abi, T>
pub fn new(ptr: &'abi T) -> UserPointer<'abi, T>
Construct a new user pointer.
sourcepub fn new_null() -> UserPointer<'abi, T>
pub fn new_null() -> UserPointer<'abi, T>
Construct a new null user pointer.
source§impl<'abi, T> UserPointer<'abi, T>where
T: Sync,
impl<'abi, T> UserPointer<'abi, T>where T: Sync,
sourcepub fn as_ref(&self, f: impl FnOnce(*const T, usize) -> bool) -> Option<&'abi T>
pub fn as_ref(&self, f: impl FnOnce(*const T, usize) -> bool) -> Option<&'abi T>
Verify a user pointer, and return it as a reference. Should be called by the kernel before using the pointer. The supplied closure should implement the kernel’s security and address space verification for this pointer. The closure should return true if the contiguous memory region delimited by the arguments is okay for the kernel to read. Note that this means the following:
- The userspace code has perms to read the memory.
- The kernel has perms to read the memory.
- The region is in a valid part of the address space.
- T is Sync.
sourcepub fn as_mut(
&mut self,
f: impl FnOnce(*mut T, usize) -> bool
) -> Option<&'abi mut T>
pub fn as_mut( &mut self, f: impl FnOnce(*mut T, usize) -> bool ) -> Option<&'abi mut T>
See Self::as_ref.
Trait Implementations§
source§impl<'abi, T> Clone for UserPointer<'abi, T>where
T: Clone,
impl<'abi, T> Clone for UserPointer<'abi, T>where T: Clone,
source§fn clone(&self) -> UserPointer<'abi, T>
fn clone(&self) -> UserPointer<'abi, T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl<'abi, T> Debug for UserPointer<'abi, T>where
T: Debug,
impl<'abi, T> Debug for UserPointer<'abi, T>where T: Debug,
source§impl<'abi, T> From<&'abi T> for UserPointer<'abi, T>
impl<'abi, T> From<&'abi T> for UserPointer<'abi, T>
source§fn from(value: &'abi T) -> UserPointer<'abi, T>
fn from(value: &'abi T) -> UserPointer<'abi, T>
Converts to this type from the input type.
source§impl<'abi, T> From<&'abi mut T> for UserPointer<'abi, T>
impl<'abi, T> From<&'abi mut T> for UserPointer<'abi, T>
source§fn from(value: &'abi mut T) -> UserPointer<'abi, T>
fn from(value: &'abi mut T) -> UserPointer<'abi, T>
Converts to this type from the input type.
source§impl<'abi, T> Hash for UserPointer<'abi, T>where
T: Hash,
impl<'abi, T> Hash for UserPointer<'abi, T>where T: Hash,
source§impl<'abi, T> Ord for UserPointer<'abi, T>where
T: Ord,
impl<'abi, T> Ord for UserPointer<'abi, T>where T: Ord,
source§fn cmp(&self, other: &UserPointer<'abi, T>) -> Ordering
fn cmp(&self, other: &UserPointer<'abi, T>) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl<'abi, T> PartialEq<UserPointer<'abi, T>> for UserPointer<'abi, T>where
T: PartialEq<T>,
impl<'abi, T> PartialEq<UserPointer<'abi, T>> for UserPointer<'abi, T>where T: PartialEq<T>,
source§fn eq(&self, other: &UserPointer<'abi, T>) -> bool
fn eq(&self, other: &UserPointer<'abi, T>) -> bool
This method tests for
self and other values to be equal, and is used
by ==.source§impl<'abi, T> PartialOrd<UserPointer<'abi, T>> for UserPointer<'abi, T>where
T: PartialOrd<T>,
impl<'abi, T> PartialOrd<UserPointer<'abi, T>> for UserPointer<'abi, T>where T: PartialOrd<T>,
source§fn partial_cmp(&self, other: &UserPointer<'abi, T>) -> Option<Ordering>
fn partial_cmp(&self, other: &UserPointer<'abi, T>) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read moresource§impl<'a, Abi, EncodedType, Encoder, T> SyscallEncodable<'a, Abi, EncodedType, Encoder> for UserPointer<'a, T>where
Abi: SyscallAbi,
EncodedType: Copy,
Encoder: SyscallEncoder<'a, Abi, EncodedType>,
T: Copy,
impl<'a, Abi, EncodedType, Encoder, T> SyscallEncodable<'a, Abi, EncodedType, Encoder> for UserPointer<'a, T>where Abi: SyscallAbi, EncodedType: Copy, Encoder: SyscallEncoder<'a, Abi, EncodedType>, T: Copy,
fn encode(&self, encoder: &mut Encoder) -> Result<(), EncodeError>
fn decode(decoder: &mut Encoder) -> Result<UserPointer<'a, T>, DecodeError>where UserPointer<'a, T>: Sized,
impl<'abi, T> Copy for UserPointer<'abi, T>where T: Copy,
impl<'abi, T> Eq for UserPointer<'abi, T>where T: Eq,
impl<'abi, T> StructuralEq for UserPointer<'abi, T>
impl<'abi, T> StructuralPartialEq for UserPointer<'abi, T>
Auto Trait Implementations§
impl<'abi, T> RefUnwindSafe for UserPointer<'abi, T>where T: RefUnwindSafe,
impl<'abi, T> Send for UserPointer<'abi, T>where T: Sync,
impl<'abi, T> Sync for UserPointer<'abi, T>where T: Sync,
impl<'abi, T> Unpin for UserPointer<'abi, T>
impl<'abi, T> UnwindSafe for UserPointer<'abi, T>where T: RefUnwindSafe,
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