Struct kernel::syscall::validation::UserSlice
source · pub struct UserSlice<'a, T> {
ptr: *mut T,
length: usize,
_phantom: PhantomData<&'a ()>,
}
Expand description
Represents a slice of T
s in userspace.
Fields§
§ptr: *mut T
§length: usize
§_phantom: PhantomData<&'a ()>
Implementations§
source§impl<'a, T> UserSlice<'a, T>
impl<'a, T> UserSlice<'a, T>
pub fn new(ptr: *mut T, length: usize) -> UserSlice<'a, T>
pub fn validate_read(&self) -> Result<&'a [T], ()>
sourcepub fn validate_write(&mut self) -> Result<&'a mut [T], ()>
pub fn validate_write(&mut self) -> Result<&'a mut [T], ()>
Validate this slice for a write, BUT DOES NOT ACTUALLY WRITE ANYTHING INTO IT. You must write into the
returned mutable reference, generally using either copy_from_slice
if T: Copy
, or clone_from_slice
otherwise.
Auto Trait Implementations§
impl<'a, T> RefUnwindSafe for UserSlice<'a, T>where T: RefUnwindSafe,
impl<'a, T> !Send for UserSlice<'a, T>
impl<'a, T> !Sync for UserSlice<'a, T>
impl<'a, T> Unpin for UserSlice<'a, T>
impl<'a, T> UnwindSafe for UserSlice<'a, T>where T: RefUnwindSafe,
Blanket Implementations§
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
source§fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Convert
Box<Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can then be
further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<dyn Any>
. Rc<dyn Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Anydyn Any
. This is needed since Rust cannot
generate &Anydyn Any
’s vtable from &Trait
’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Anydyn Any
. This is needed since Rust cannot
generate &mut dyn Any
’s vtable from &mut Trait
’s.