pub struct UserPtr<'a, T: Sized, R: Copy + Repr<T> = *const T> { /* private fields */ }
Expand description
A pointer to readable userspace memory with a defined in-memory representation.
This exists primarily for use in defining safe ioctl
/etc request types,
to ensure that only valid addresses can be assigned to a field from
safe Rust.
If a struct type used with an ioctl request has a field containing an
address that the kernel only reads from then defining that field as
a UserPtr
ensures that it can only have a valid address assigned
to it unless the caller uses the unsafe Self::from_ptr
.
The in-memory representation of this type is guaranteed to match
that of type parameter R
, which defaults to being a pointer to T
.
Implementations§
Source§impl<'a, T: Sized, R: Copy + Repr<T>> UserPtr<'a, T, R>
impl<'a, T: Sized, R: Copy + Repr<T>> UserPtr<'a, T, R>
Auto Trait Implementations§
impl<'a, T, R> Freeze for UserPtr<'a, T, R>where
R: Freeze,
impl<'a, T, R> RefUnwindSafe for UserPtr<'a, T, R>where
R: RefUnwindSafe,
T: RefUnwindSafe,
impl<'a, T, R> Send for UserPtr<'a, T, R>
impl<'a, T, R> Sync for UserPtr<'a, T, R>
impl<'a, T, R> Unpin for UserPtr<'a, T, R>where
R: Unpin,
impl<'a, T, R> UnwindSafe for UserPtr<'a, T, R>where
R: UnwindSafe,
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