Struct sim::analytics::SlidingWindow[][src]

pub struct SlidingWindow {
    times: VecDeque<Time>,
    window_size: Duration,
}

A sliding window, used to count something over time

Fields

times: VecDeque<Time>window_size: Duration

Implementations

impl SlidingWindow[src]

pub fn new(window_size: Duration) -> SlidingWindow[src]

pub fn add(&mut self, time: Time) -> usize[src]

Returns the count at time

pub fn count(&mut self, end: Time) -> usize[src]

Grab the count at this time, but don’t add a new time

pub fn close_off_pts(&mut self, pts: &mut Vec<(Time, usize)>, end_time: Time)[src]

Ensure the points cover up to end_time. The last event may occur before then, and it’s necessary to draw more points to show the count drop off.

Auto Trait Implementations

impl RefUnwindSafe for SlidingWindow

impl Send for SlidingWindow

impl Sync for SlidingWindow

impl Unpin for SlidingWindow

impl UnwindSafe for SlidingWindow

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Downcast for T where
    T: Any

impl<T> DowncastSync for T where
    T: Any + Send + Sync

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,