pub struct Counter {
pub name: &'static str,
pub unit: &'static str,
pub show_as: ShowAs,
pub expected: Expected<f64>,
value: f64,
num_samples: u64,
sum: f64,
next_max: f64,
max: f64,
avg: f64,
change_indicator: u8,
graph: Option<Graph>,
}
Fields§
§name: &'static str
§unit: &'static str
§show_as: ShowAs
§expected: Expected<f64>
§value: f64
§num_samples: u64
Number of samples in the current time slice.
sum: f64
Sum of the values recorded during the current time slice.
next_max: f64
The max value in in-progress time slice.
max: f64
The max value of the previous time slice (displayed).
avg: f64
The average value of the previous time slice (displayed).
change_indicator: u8
Incremented when the counter changes.
graph: Option<Graph>
Implementations§
source§impl Counter
impl Counter
pub fn new(descriptor: &CounterDescriptor) -> Self
pub fn set_f64(&mut self, val: f64)
pub fn set<T>(&mut self, val: T)where T: Into<f64>,
pub fn get(&self) -> Option<f64>
pub fn write_value(&self, output: &mut String)
pub fn enable_graph(&mut self, max_samples: usize)
pub fn disable_graph(&mut self)
pub fn is_unexpected_value(&self, value: f64) -> bool
pub fn has_unexpected_value(&self) -> bool
pub fn has_unexpected_avg_max(&self) -> bool
fn update(&mut self, update_avg: bool)
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Counter
impl Send for Counter
impl Sync for Counter
impl Unpin for Counter
impl UnwindSafe for Counter
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
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>where
F: FnOnce(&Self) -> bool,
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>where F: FnOnce(&Self) -> bool,
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