pub struct OpaqueMemory { /* private fields */ }Expand description
Adapter to erase the type of a MemoryShared implementation.
This adapter adds some inefficiency due to additional indirection overhead for every memory reservation, so avoid this adapter if you can tolerate alternatives (generics).
Implementations§
Source§impl OpaqueMemory
impl OpaqueMemory
Sourcepub fn new(inner: impl MemoryShared) -> Self
pub fn new(inner: impl MemoryShared) -> Self
Creates a new instance of the adapter.
Sourcepub fn reserve(&self, min_bytes: usize) -> BytesBuf
pub fn reserve(&self, min_bytes: usize) -> BytesBuf
Reserves at least min_bytes bytes of memory capacity.
Returns an empty BytesBuf that can be used to fill the reserved memory with data.
The memory provider may provide more memory than requested.
The memory reservation request will always be fulfilled, obtaining more memory from the operating system if necessary.
§Zero-sized reservations
Reserving zero bytes of memory is a valid operation and will return a BytesBuf
with zero or more bytes of capacity.
§Panics
May panic if the operating system runs out of memory.
Trait Implementations§
Source§impl Clone for OpaqueMemory
impl Clone for OpaqueMemory
Source§fn clone(&self) -> OpaqueMemory
fn clone(&self) -> OpaqueMemory
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for OpaqueMemory
impl Debug for OpaqueMemory
Auto Trait Implementations§
impl Freeze for OpaqueMemory
impl !RefUnwindSafe for OpaqueMemory
impl Send for OpaqueMemory
impl Sync for OpaqueMemory
impl Unpin for OpaqueMemory
impl !UnwindSafe for OpaqueMemory
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