pub struct UserPtr(/* private fields */);
Expand description
A pointer into userspace.
This is the Rust equivalent to C pointers tagged with __user
.
Implementations§
Source§impl UserPtr
impl UserPtr
Sourcepub fn from_addr(addr: usize) -> Self
pub fn from_addr(addr: usize) -> Self
Create a UserPtr
from an integer representing the userspace address.
Sourcepub fn from_ptr(addr: *mut c_void) -> Self
pub fn from_ptr(addr: *mut c_void) -> Self
Create a UserPtr
from a pointer representing the userspace address.
Sourcepub fn as_const_ptr(self) -> *const c_void
pub fn as_const_ptr(self) -> *const c_void
Cast this userspace pointer to a raw const void pointer.
It is up to the caller to use the returned pointer correctly.
Sourcepub fn as_mut_ptr(self) -> *mut c_void
pub fn as_mut_ptr(self) -> *mut c_void
Cast this userspace pointer to a raw mutable void pointer.
It is up to the caller to use the returned pointer correctly.
Sourcepub fn wrapping_byte_add(self, add: usize) -> UserPtr
pub fn wrapping_byte_add(self, add: usize) -> UserPtr
Increment this user pointer by add
bytes.
This addition is wrapping, so wrapping around the address space does not result in a panic
even if CONFIG_RUST_OVERFLOW_CHECKS
is enabled.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for UserPtr
impl RefUnwindSafe for UserPtr
impl !Send for UserPtr
impl !Sync for UserPtr
impl Unpin for UserPtr
impl UnwindSafe for UserPtr
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> PinInit<T> for T
impl<T> PinInit<T> for T
Source§unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), Infallible>
unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), Infallible>
Initializes
slot
. Read more