pub struct HeapBytes { /* private fields */ }Expand description
Opaque byte buffer charged against a MemoryBudget.
The charge is the slice length, the same unit a register Bytes pays.
Spare capacity in the Vec is not charged.
Implementations§
Source§impl HeapBytes
impl HeapBytes
pub fn new( budget: Arc<MemoryBudget>, bytes: impl Into<Vec<u8>>, ) -> Result<Self, MemoryError>
pub fn as_slice(&self) -> &[u8] ⓘ
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl Freeze for HeapBytes
impl RefUnwindSafe for HeapBytes
impl Send for HeapBytes
impl Sync for HeapBytes
impl Unpin for HeapBytes
impl UnsafeUnpin for HeapBytes
impl UnwindSafe for HeapBytes
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