Struct Windowing

Source
pub struct Windowing<P> { /* private fields */ }
Expand description

Windowing is a mechanism for rotating between different observations. It provides an accessor Windowing::current for the current observation, and a method Windowing::cycle_windows which makes the next observation in the ring current, and returns the observation which was current prior to the call.

Implementations§

Source§

impl<P: Default> Windowing<P>

Source

pub fn new() -> Self

Constructor. Initializes its owned ring of Ps using Default::default().

Source

pub fn current(&self) -> &P

Get the current collection. The underling P is expected to be cycled on some regular interval.

Data integrity guarantees are weak. In some circumstances, the returned P window may be for the prior interval, if whatever wants to write a datapoint races with something replacing the current P. It is even possible (if extremely unlikely) for a value to be written into an old P collection, if the writer races with a reader and writes after the reader has emptied the collection and released its lock.

Source

pub fn cycle_windows(&self) -> &P

Cycle to the next window. Returns the window which was active before the call.

Auto Trait Implementations§

§

impl<P> !Freeze for Windowing<P>

§

impl<P> RefUnwindSafe for Windowing<P>
where P: RefUnwindSafe,

§

impl<P> Send for Windowing<P>
where P: Send,

§

impl<P> Sync for Windowing<P>
where P: Sync,

§

impl<P> Unpin for Windowing<P>

§

impl<P> UnwindSafe for Windowing<P>
where P: 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.