pub struct ContextGauge { /* private fields */ }Expand description
One run’s gauge. Fed the provider’s input_tokens after every call;
answers a reminder the first time each threshold is crossed.
Implementations§
Source§impl ContextGauge
impl ContextGauge
Sourcepub fn new(window: Tokens, second: Option<SecondThreshold>) -> ContextGauge
pub fn new(window: Tokens, second: Option<SecondThreshold>) -> ContextGauge
second is the configuration ladder’s answer for this run, and
None means no layer spoke: the default applies here, at the one
place a rung is read.
Sourcepub fn observe(&mut self, used: Tokens) -> Option<ContextReminder>
pub fn observe(&mut self, used: Tokens) -> Option<ContextReminder>
Reads one usage figure. None when no threshold was newly
crossed, and always None for a window of zero: without a
denominator there is no percentage to report.
Trait Implementations§
Source§impl Clone for ContextGauge
impl Clone for ContextGauge
Source§impl Debug for ContextGauge
impl Debug for ContextGauge
impl Eq for ContextGauge
Source§impl PartialEq for ContextGauge
impl PartialEq for ContextGauge
impl StructuralPartialEq for ContextGauge
Auto Trait Implementations§
impl Freeze for ContextGauge
impl RefUnwindSafe for ContextGauge
impl Send for ContextGauge
impl Sync for ContextGauge
impl Unpin for ContextGauge
impl UnsafeUnpin for ContextGauge
impl UnwindSafe for ContextGauge
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