pub struct SlidingWindow { /* private fields */ }Expand description
A sliding window that maintains overlapping windows
Implementations§
Source§impl SlidingWindow
impl SlidingWindow
pub const fn new(window_size: Duration, slide_interval: Duration) -> Self
Add a shared event, returning window contents if slide interval reached.
Get current window contents as shared references.
Sourcepub fn current(&self) -> Vec<Event>
pub fn current(&self) -> Vec<Event>
Get current window contents (clones for backward compatibility).
Sourcepub fn checkpoint(&self) -> WindowCheckpoint
pub fn checkpoint(&self) -> WindowCheckpoint
Create a checkpoint of the current window state.
Sourcepub fn restore(&mut self, cp: &WindowCheckpoint)
pub fn restore(&mut self, cp: &WindowCheckpoint)
Restore window state from a checkpoint.
Sourcepub fn advance_watermark(
&mut self,
wm: DateTime<Utc>,
) -> Option<Vec<SharedEvent>>
pub fn advance_watermark( &mut self, wm: DateTime<Utc>, ) -> Option<Vec<SharedEvent>>
Advance watermark — emit window if slide interval has passed relative to watermark.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SlidingWindow
impl RefUnwindSafe for SlidingWindow
impl Send for SlidingWindow
impl Sync for SlidingWindow
impl Unpin for SlidingWindow
impl UnsafeUnpin for SlidingWindow
impl UnwindSafe for SlidingWindow
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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