Trait ZeroInitializedStats

Source
pub trait ZeroInitializedStats {
    // Required methods
    fn needs_zero_initialization(&self) -> bool;
    fn mark_zero_initialized(&mut self);
    fn zero_stat(&self) -> Self;
}
Expand description

Stats that should be initialized with a row of zeroes, that is we want the first data to show up in the builtin stats collection to be zeroes.

We do the tracking within the stat object itself instead of adding external tracking. That’s a bit of a roundabout way of doing it, but it works.

This is an odd requirement, and you would think we should just report what is there when we get it, but this was consciously changed a while back and the current Console incarnation depends on this behavior.

Required Methods§

Source

fn needs_zero_initialization(&self) -> bool

True if we have have not emitted a “zero update” for this stats blob.

Source

fn mark_zero_initialized(&mut self)

Marks that we have emitted a “zero update” for this stats blob.

Source

fn zero_stat(&self) -> Self

Returns a “all zero” instance of this stat, with collection id and/or replica id retained.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§