pub struct Preallocated<Buffer> { /* private fields */ }
Expand description
A wrapper that implements CanAlloc
over a preallocated buffer
Implementations§
Source§impl<Buffer> Preallocated<Buffer>
impl<Buffer> Preallocated<Buffer>
Sourcepub const fn new_with_used(buffer: Buffer, used: usize) -> Self
pub const fn new_with_used(buffer: Buffer, used: usize) -> Self
Create a new Preallocated
instance by wrapping buffer
and sets the amount of used bytes to used
Discussion: If used
is greated than buffer.len()
, it will be silently capped to buffer.len()
wherever
necessary
Sourcepub fn into_inner(self) -> Buffer
pub fn into_inner(self) -> Buffer
Returns the wrapped buffer
Trait Implementations§
Source§impl<Buffer, T> AsMut<[T]> for Preallocated<Buffer>
impl<Buffer, T> AsMut<[T]> for Preallocated<Buffer>
Auto Trait Implementations§
impl<Buffer> Freeze for Preallocated<Buffer>where
Buffer: Freeze,
impl<Buffer> RefUnwindSafe for Preallocated<Buffer>where
Buffer: RefUnwindSafe,
impl<Buffer> Send for Preallocated<Buffer>where
Buffer: Send,
impl<Buffer> Sync for Preallocated<Buffer>where
Buffer: Sync,
impl<Buffer> Unpin for Preallocated<Buffer>where
Buffer: Unpin,
impl<Buffer> UnwindSafe for Preallocated<Buffer>where
Buffer: UnwindSafe,
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