pub struct IoBufferMut<'a> {
pointer: *mut u8,
size: usize,
_lifetime: PhantomData<&'a mut [u8]>,
}
Expand description
Reference to any mutable memory buffer.
Fields§
§pointer: *mut u8
Raw pointer to the start of the buffer.
size: usize
Size in bytes.
_lifetime: PhantomData<&'a mut [u8]>
Lifetime marker.
Implementations§
Source§impl<'a> IoBufferMut<'a>
impl<'a> IoBufferMut<'a>
Sourcepub fn from_slice(slice: &'a mut [u8]) -> Self
pub fn from_slice(slice: &'a mut [u8]) -> Self
Create a reference to a slice.
Sourcepub fn try_into_owned(self, alignment: usize) -> Result<IoBuffer>
pub fn try_into_owned(self, alignment: usize) -> Result<IoBuffer>
Create an owned IoBuffer
with the same data (copied).
Sourcepub fn into_slice(self) -> &'a mut [u8] ⓘ
pub fn into_slice(self) -> &'a mut [u8] ⓘ
Turn this reference into a slice.
References to IoBuffer
s must not be copied/cloned (so they can only be accessed once;
they are considered volatile due to potential VM guest accesses), so this consumes the
object.
Sourcepub unsafe fn into_typed_slice<T: Copy + Sized>(self) -> &'a mut [T]
pub unsafe fn into_typed_slice<T: Copy + Sized>(self) -> &'a mut [T]
Turn this reference into a slice with the given element type.
§Safety
Caller must ensure that alignment and length requirements are met and that the resulting data is valid.
Sourcepub fn split_at(self, mid: usize) -> (IoBufferMut<'a>, IoBufferMut<'a>)
pub fn split_at(self, mid: usize) -> (IoBufferMut<'a>, IoBufferMut<'a>)
Split the buffer at mid
.
Return &self[..mid]
and &self[mid..]
.
If mid > self.len()
, return &self[..]
and []
.
Sourcepub fn into_ref(self) -> IoBufferRef<'a>
pub fn into_ref(self) -> IoBufferRef<'a>
Make this reference immutable.
Trait Implementations§
Source§impl<'a> From<IoBufferMut<'a>> for IoSliceMut<'a>
impl<'a> From<IoBufferMut<'a>> for IoSliceMut<'a>
Source§fn from(buf: IoBufferMut<'a>) -> Self
fn from(buf: IoBufferMut<'a>) -> Self
Converts to this type from the input type.
Source§impl<'a> From<IoBufferMut<'a>> for IoVectorMut<'a>
impl<'a> From<IoBufferMut<'a>> for IoVectorMut<'a>
Source§fn from(buffer: IoBufferMut<'a>) -> Self
fn from(buffer: IoBufferMut<'a>) -> Self
Converts to this type from the input type.
Source§impl<'a> From<IoSliceMut<'a>> for IoBufferMut<'a>
impl<'a> From<IoSliceMut<'a>> for IoBufferMut<'a>
Source§fn from(slice: IoSliceMut<'a>) -> Self
fn from(slice: IoSliceMut<'a>) -> Self
Converts to this type from the input type.
Source§impl<'a> IoBufferRefTrait<'a> for IoBufferMut<'a>
impl<'a> IoBufferRefTrait<'a> for IoBufferMut<'a>
Source§fn from_slice(slice: Self::SliceType<u8>) -> Self
fn from_slice(slice: Self::SliceType<u8>) -> Self
Create a reference to a slice.
Source§fn try_into_owned(self, alignment: usize) -> Result<IoBuffer>
fn try_into_owned(self, alignment: usize) -> Result<IoBuffer>
Create an owned
IoBuffer
with the same data (copied).Source§fn as_ptr(&self) -> Self::PointerType<u8>
fn as_ptr(&self) -> Self::PointerType<u8>
Return the pointer to the start of the buffer.
Source§fn into_ref(self) -> IoBufferRef<'a>
fn into_ref(self) -> IoBufferRef<'a>
Make this reference immutable.
impl Send for IoBufferMut<'_>
impl Sync for IoBufferMut<'_>
Auto Trait Implementations§
impl<'a> Freeze for IoBufferMut<'a>
impl<'a> RefUnwindSafe for IoBufferMut<'a>
impl<'a> Unpin for IoBufferMut<'a>
impl<'a> !UnwindSafe for IoBufferMut<'a>
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