pub struct TimeWindow { /* private fields */ }Expand description
A time-based window with start and end timestamps.
This is the fundamental window type for time-based windowing strategies.
Implementations§
Source§impl TimeWindow
impl TimeWindow
Sourcepub fn new(start: DateTime<Utc>, end: DateTime<Utc>) -> Self
pub fn new(start: DateTime<Utc>, end: DateTime<Utc>) -> Self
Creates a new time window with the given start and end.
Sourcepub fn duration(&self) -> ChronoDuration
pub fn duration(&self) -> ChronoDuration
Returns the duration of the window.
Sourcepub fn max_timestamp(&self) -> DateTime<Utc>
pub fn max_timestamp(&self) -> DateTime<Utc>
Returns the maximum timestamp for elements in this window.
Sourcepub fn contains(&self, timestamp: DateTime<Utc>) -> bool
pub fn contains(&self, timestamp: DateTime<Utc>) -> bool
Returns true if the given timestamp falls within this window.
Sourcepub fn intersects(&self, other: &TimeWindow) -> bool
pub fn intersects(&self, other: &TimeWindow) -> bool
Returns true if this window intersects with another.
Sourcepub fn merge(&self, other: &TimeWindow) -> Option<TimeWindow>
pub fn merge(&self, other: &TimeWindow) -> Option<TimeWindow>
Merges this window with another overlapping window.
Trait Implementations§
Source§impl Clone for TimeWindow
impl Clone for TimeWindow
Source§fn clone(&self) -> TimeWindow
fn clone(&self) -> TimeWindow
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TimeWindow
impl Debug for TimeWindow
Source§impl Display for TimeWindow
impl Display for TimeWindow
Source§impl Hash for TimeWindow
impl Hash for TimeWindow
Source§impl Ord for TimeWindow
impl Ord for TimeWindow
Source§impl PartialEq for TimeWindow
impl PartialEq for TimeWindow
Source§impl PartialOrd for TimeWindow
impl PartialOrd for TimeWindow
Source§impl Window for TimeWindow
impl Window for TimeWindow
Source§impl WindowTrigger<TimeWindow> for EventTimeTrigger
impl WindowTrigger<TimeWindow> for EventTimeTrigger
Source§fn on_element(
&mut self,
_timestamp: DateTime<Utc>,
_window: &TimeWindow,
) -> TriggerResult
fn on_element( &mut self, _timestamp: DateTime<Utc>, _window: &TimeWindow, ) -> TriggerResult
Called when an element is added to a window.
Source§fn on_processing_time(
&mut self,
_time: DateTime<Utc>,
_window: &TimeWindow,
) -> TriggerResult
fn on_processing_time( &mut self, _time: DateTime<Utc>, _window: &TimeWindow, ) -> TriggerResult
Called when processing time advances.
Source§fn on_event_time(
&mut self,
watermark: DateTime<Utc>,
window: &TimeWindow,
) -> TriggerResult
fn on_event_time( &mut self, watermark: DateTime<Utc>, window: &TimeWindow, ) -> TriggerResult
Called when the watermark (event time) advances.
Source§fn clear(&mut self, _window: &TimeWindow)
fn clear(&mut self, _window: &TimeWindow)
Called when the trigger is cleared.
Source§fn clone_trigger(&self) -> Box<dyn WindowTrigger<TimeWindow>>
fn clone_trigger(&self) -> Box<dyn WindowTrigger<TimeWindow>>
Creates a clone of this trigger.
Source§impl WindowTrigger<TimeWindow> for ProcessingTimeTrigger
impl WindowTrigger<TimeWindow> for ProcessingTimeTrigger
Source§fn on_element(
&mut self,
_timestamp: DateTime<Utc>,
_window: &TimeWindow,
) -> TriggerResult
fn on_element( &mut self, _timestamp: DateTime<Utc>, _window: &TimeWindow, ) -> TriggerResult
Called when an element is added to a window.
Source§fn on_processing_time(
&mut self,
time: DateTime<Utc>,
window: &TimeWindow,
) -> TriggerResult
fn on_processing_time( &mut self, time: DateTime<Utc>, window: &TimeWindow, ) -> TriggerResult
Called when processing time advances.
Source§fn on_event_time(
&mut self,
_watermark: DateTime<Utc>,
_window: &TimeWindow,
) -> TriggerResult
fn on_event_time( &mut self, _watermark: DateTime<Utc>, _window: &TimeWindow, ) -> TriggerResult
Called when the watermark (event time) advances.
Source§fn clear(&mut self, window: &TimeWindow)
fn clear(&mut self, window: &TimeWindow)
Called when the trigger is cleared.
Source§fn clone_trigger(&self) -> Box<dyn WindowTrigger<TimeWindow>>
fn clone_trigger(&self) -> Box<dyn WindowTrigger<TimeWindow>>
Creates a clone of this trigger.
impl Eq for TimeWindow
Auto Trait Implementations§
impl Freeze for TimeWindow
impl RefUnwindSafe for TimeWindow
impl Send for TimeWindow
impl Sync for TimeWindow
impl Unpin for TimeWindow
impl UnwindSafe for TimeWindow
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