pub struct HeapStr { /* private fields */ }Expand description
UTF-8 heap buffer charged against a MemoryBudget.
The charge is str::len, the same unit a register Str pays. Spare
capacity in the String is not charged.
Self::new / Self::replace take an already-built String (via
Into); any allocation performed by the caller happens before the
budget sees it — see the module docs.
Implementations§
Source§impl HeapStr
impl HeapStr
pub fn new( budget: Arc<MemoryBudget>, value: impl Into<String>, ) -> Result<Self, MemoryError>
pub fn as_str(&self) -> &str
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl Freeze for HeapStr
impl RefUnwindSafe for HeapStr
impl Send for HeapStr
impl Sync for HeapStr
impl Unpin for HeapStr
impl UnsafeUnpin for HeapStr
impl UnwindSafe for HeapStr
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