[−][src]Struct kernel::AppSlice
Buffer of memory shared from an app to the kernel.
This is the type created after an app calls the allow
syscall.
Implementations
impl<L, T> AppSlice<L, T>
[src]
pub unsafe fn new_external(
ptr: NonNull<T>,
len: usize,
appid: AppId,
_capability: &dyn ExternalProcessCapability
) -> AppSlice<L, T>
[src]
ptr: NonNull<T>,
len: usize,
appid: AppId,
_capability: &dyn ExternalProcessCapability
) -> AppSlice<L, T>
Safety: Trusts that ptr
+ len
is a buffer in the memory region owned
by appid
and that no other references to that memory range exist.
This constructor is public but protected with a capability to enable
external implementations of ProcessType
to create AppSlice
s.
pub fn len(&self) -> usize
[src]
Number of bytes in the AppSlice
.
If the app died, has restarted, or its AppId identifier
changed for any other reason, return an accessible length of
zero, consistent with the AsRef
and AsMut
implementations.
pub fn ptr(&self) -> *const T
[src]
Get the raw pointer to the buffer. This will be a pointer inside of the app's memory region.
pub fn iter(&self) -> Iter<'_, T>
[src]
Returns an iterator over the slice
See
std::slice::iter()
.
Internally this uses
AsRef
, hence when
the app dies, restarts or the
AppId
changes for any other
reason, the iterator will be of zero length.
pub fn iter_mut(&mut self) -> IterMut<'_, T>
[src]
Returns an iterator that allows modifying each value
Internally this uses
AsMut
, hence when
the app dies, restarts or the
AppId
changes for any other
reason, the iterator will be of zero length.
pub fn chunks(&self, size: usize) -> Chunks<'_, T>
[src]
Iterate over chunk_size
elements at a time, starting at the
beginning of the AppSlice.
See
std::slice::chunks()
.
Internally this uses
AsRef
, hence when
the app dies, restarts or the
AppId
changes for any other
reason, a Chunks
iterator of zero length will
be returned.
pub fn chunks_mut(&mut self, size: usize) -> ChunksMut<'_, T>
[src]
Trait Implementations
impl<L, T> AsMut<[T]> for AppSlice<L, T>
[src]
pub fn as_mut(&mut self) -> &mut [T]
[src]
Get a mutable slice reference over the userspace buffer
This first checks whether the app died, restarted, or its AppId identifier changed for any other reason. In this case, a slice of length zero is returned.
impl<L, T> AsRef<[T]> for AppSlice<L, T>
[src]
Auto Trait Implementations
impl<L, T> !Send for AppSlice<L, T>
[src]
impl<L, T> !Sync for AppSlice<L, T>
[src]
impl<L, T> Unpin for AppSlice<L, T> where
L: Unpin,
[src]
L: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,