pub struct IoSlice(/* private fields */);
Expand description
An unsafe, 'static
, initialized, and immutable slice of bytes to interact
with system API.
Like IoSlice
in std
, IoSlice
guarantees the ABI compatibility
on unix and windows, but without the lifetime, makes it easier to use with
compio driver at the cost of unsafe to construct. IoSlice
should only be
used with compio driver.
Implementations§
Source§impl IoSlice
impl IoSlice
Sourcepub unsafe fn new(ptr: *const u8, len: usize) -> Self
pub unsafe fn new(ptr: *const u8, len: usize) -> Self
Create a new IoSlice
from a raw pointer and a length.
§Safety
The caller must ensure that:
- the pointer is valid for the lifetime of the
IoSlice
- the length is correct
- the content of the buffer is initialized
- the pointer is not used for mutating while the
IoSlice
is in use
Sourcepub unsafe fn from_slice(slice: &[u8]) -> Self
pub unsafe fn from_slice(slice: &[u8]) -> Self
Create a new IoSlice
from an initialized slice.
§Safety
The caller must ensure that, during the lifetime of the IoSlice
, the
slice is valid the and is not used for mutating.
Auto Trait Implementations§
impl Freeze for IoSlice
impl RefUnwindSafe for IoSlice
impl !Send for IoSlice
impl !Sync for IoSlice
impl Unpin for IoSlice
impl UnwindSafe for IoSlice
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