Struct Observations

Source
pub struct Observations<T: Ord + Zero + Copy> { /* private fields */ }
Expand description

Collect observations, which are sampled as a Sample.

Implementations§

Source§

impl<T: Ord + Zero + Copy> Observations<T>

Source

pub fn new(name: &'static str) -> Self

Constructor. The name parameter has no semantic meaning, and is only exposed by Observations::name().

Source

pub fn name(&self) -> &'static str

Name associated with the observations, as provided in constructor.

Source

pub fn sample(&self) -> Sample<T>

Take a sample of the observations. Calculates a Sample corresponding to the current state, and then clears that state.

Source

pub fn record(&self, observation: T)

Attempt to record this T as part of the collection of observations. “Attempt”, because if a reader is currently using this ObservationSet, the observation is dropped. This prevents recording from being a blocking operation

Auto Trait Implementations§

§

impl<T> !Freeze for Observations<T>

§

impl<T> !RefUnwindSafe for Observations<T>

§

impl<T> Send for Observations<T>
where T: Send,

§

impl<T> Sync for Observations<T>
where T: Send,

§

impl<T> Unpin for Observations<T>

§

impl<T> UnwindSafe for Observations<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.