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 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; every later call — including the response-envelope read — returns the same frozen object, so both read paths carry the identical value even if stray increments (e.g. the post-audit dispatch hook) land afterwards.
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.
Trait Implementations§
Source§impl Clone for UsageContext
impl Clone for UsageContext
Source§fn clone(&self) -> UsageContext
fn clone(&self) -> UsageContext
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 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
Returns the “default value” for a type. Read more
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
Mutably borrows from an owned value. Read more
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> ⓘ
Converts
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> ⓘ
Converts
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