pub struct IoBuffer {
pointer: *mut u8,
size: usize,
layout: Option<Layout>,
}Expand description
Owned memory buffer.
Fields§
§pointer: *mut u8Raw pointer to the start of the buffer.
size: usizeSize in bytes.
layout: Option<Layout>Allocation layout. None only for null buffers.
Implementations§
Source§impl IoBuffer
impl IoBuffer
Sourcepub fn new(size: usize, alignment: usize) -> Result<Self>
pub fn new(size: usize, alignment: usize) -> Result<Self>
Create a new owned buffer, containing uninitialized data.
Do note that the returned buffer contains uninitialized data, which however is perfectly fine for an I/O buffer.
Sourcepub fn new_with_layout(layout: Layout) -> Result<Self>
pub fn new_with_layout(layout: Layout) -> Result<Self>
Create a new owned buffer, containing uninitialized data, with the given layout.
Sourcepub fn as_ref(&self) -> IoBufferRef<'_>
pub fn as_ref(&self) -> IoBufferRef<'_>
Generate an immutable reference.
Sourcepub fn as_ref_range(&self, range: Range<usize>) -> IoBufferRef<'_>
pub fn as_ref_range(&self, range: Range<usize>) -> IoBufferRef<'_>
Generate an immutable reference to a sub-range.
Sourcepub fn as_mut(&mut self) -> IoBufferMut<'_>
pub fn as_mut(&mut self) -> IoBufferMut<'_>
Generate a mutable reference.
Sourcepub fn as_mut_range(&mut self, range: Range<usize>) -> IoBufferMut<'_>
pub fn as_mut_range(&mut self, range: Range<usize>) -> IoBufferMut<'_>
Generate a mutable reference to a sub-range.
Trait Implementations§
Source§impl<'a> From<&'a mut IoBuffer> for IoVectorMut<'a>
impl<'a> From<&'a mut IoBuffer> for IoVectorMut<'a>
impl Send for IoBuffer
impl Sync for IoBuffer
Auto Trait Implementations§
impl Freeze for IoBuffer
impl RefUnwindSafe for IoBuffer
impl Unpin for IoBuffer
impl UnsafeUnpin for IoBuffer
impl UnwindSafe for IoBuffer
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