pub struct UsageContext { /* private fields */ }Expand description
The Arc-shared dispatch-accounting context (Amendment 2 Part 2).
Implementations§
Source§impl UsageContext
impl UsageContext
pub fn new() -> UsageContext
Sourcepub fn mark_unmeasured(&self)
pub fn mark_unmeasured(&self)
Permanently suppress shipping counters whose completeness is unknown.
Sourcepub fn shipping_snapshot(&self) -> Option<Value>
pub fn shipping_snapshot(&self) -> Option<Value>
The shipping snapshot, unless completeness became unknown. A mark wins even when the counters were already frozen; later adds cannot clear it.
Sourcepub fn add(&self, unit: UsageUnit, n: u64)
pub fn add(&self, unit: UsageUnit, n: u64)
Add n to one counter. Saturating: a counter never wraps.
Sourcepub fn freeze(&self) -> Value
pub fn freeze(&self) -> Value
Freeze the counters once, at the audit-snapshot point (Amendment 2
Part 3 ordering: after request-owned children are joined and non-audit
appends have resolved, before the enclosing audit row is written).
The first call takes the snapshot; later internal reads return the
same object even if stray increments land afterwards. Shipping reads
additionally check completeness with Self::shipping_snapshot.
Sourcepub fn frozen_or_snapshot(&self) -> Value
pub fn frozen_or_snapshot(&self) -> Value
The frozen object if Self::freeze ran, else a live snapshot.
Sourcepub fn snapshot(&self) -> Value
pub fn snapshot(&self) -> Value
Read the counters for internal accounting. Zero-valued counters
are omitted; a fully zero snapshot still returns an (empty) object —
“measured, nothing counted” is distinct from “not measured”, which is
represented by Self::shipping_snapshot returning None.
Trait Implementations§
Source§impl Clone for UsageContext
impl Clone for UsageContext
Source§fn clone(&self) -> UsageContext
fn clone(&self) -> UsageContext
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for UsageContext
impl Debug for UsageContext
Source§impl Default for UsageContext
impl Default for UsageContext
Source§fn default() -> UsageContext
fn default() -> UsageContext
Auto Trait Implementations§
impl Freeze for UsageContext
impl RefUnwindSafe for UsageContext
impl Send for UsageContext
impl Sync for UsageContext
impl Unpin for UsageContext
impl UnsafeUnpin for UsageContext
impl UnwindSafe for UsageContext
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more