pub struct MemoryTracker { /* private fields */ }Expand description
Concurrent, exact accounting for memory explicitly owned by a stream.
Reservations fail before the configured hard limit is exceeded. Dropping a
MemoryReservation releases its bytes, including during error unwinding.
Implementations§
Source§impl MemoryTracker
impl MemoryTracker
Sourcepub fn new(budget: MemoryBudget) -> Self
pub fn new(budget: MemoryBudget) -> Self
Creates a tracker for budget.
Sourcepub fn try_reserve(&self, bytes: u64) -> RecordsResult<MemoryReservation>
pub fn try_reserve(&self, bytes: u64) -> RecordsResult<MemoryReservation>
Atomically reserves bytes or fails without changing the current count.
Sourcepub fn snapshot(&self) -> MemorySnapshot
pub fn snapshot(&self) -> MemorySnapshot
Returns an atomic snapshot of current, peak, and limit bytes.
Trait Implementations§
Source§impl Clone for MemoryTracker
impl Clone for MemoryTracker
Source§fn clone(&self) -> MemoryTracker
fn clone(&self) -> MemoryTracker
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for MemoryTracker
impl RefUnwindSafe for MemoryTracker
impl Send for MemoryTracker
impl Sync for MemoryTracker
impl Unpin for MemoryTracker
impl UnsafeUnpin for MemoryTracker
impl UnwindSafe for MemoryTracker
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