pub struct WindowFunction;Expand description
Stateless windowing utility.
Implementations§
Source§impl WindowFunction
impl WindowFunction
Sourcepub fn apply(data: &[DataPoint], window_type: &WindowType) -> WindowResult
pub fn apply(data: &[DataPoint], window_type: &WindowType) -> WindowResult
Apply the specified WindowType to data and return the result.
Sourcepub fn tumbling(data: &[DataPoint], size_ms: i64) -> Vec<Window>
pub fn tumbling(data: &[DataPoint], size_ms: i64) -> Vec<Window>
Compute non-overlapping (tumbling) windows of size_ms milliseconds.
Windows are aligned to multiples of size_ms from epoch 0.
Empty windows between the first and last occupied window are included.
Sourcepub fn sliding(data: &[DataPoint], size_ms: i64, step_ms: i64) -> Vec<Window>
pub fn sliding(data: &[DataPoint], size_ms: i64, step_ms: i64) -> Vec<Window>
Compute overlapping (sliding) windows of size_ms, advanced by step_ms.
A window [t, t+size_ms) is created for every t = floor(first/step)*step, ...
up to the last timestamp. If step_ms >= size_ms the windows do not overlap.
Sourcepub fn session(data: &[DataPoint], gap_ms: i64) -> Vec<Window>
pub fn session(data: &[DataPoint], gap_ms: i64) -> Vec<Window>
Compute session windows: a new window opens on each point and closes
when the gap to the next point exceeds gap_ms.
Sourcepub fn aggregate(window: &Window) -> WindowAggregation
pub fn aggregate(window: &Window) -> WindowAggregation
Compute aggregated statistics for a single window.
Sourcepub fn aggregate_all(result: &WindowResult) -> Vec<WindowAggregation>
pub fn aggregate_all(result: &WindowResult) -> Vec<WindowAggregation>
Aggregate every window in a WindowResult.
Sourcepub fn by_key(
data: &[DataPoint],
window_type: &WindowType,
) -> HashMap<String, WindowResult>
pub fn by_key( data: &[DataPoint], window_type: &WindowType, ) -> HashMap<String, WindowResult>
Group data by DataPoint::key, apply the window type to each group,
and return a map of key → WindowResult.
Points with key = None are grouped under the empty string "".
Auto Trait Implementations§
impl Freeze for WindowFunction
impl RefUnwindSafe for WindowFunction
impl Send for WindowFunction
impl Sync for WindowFunction
impl Unpin for WindowFunction
impl UnsafeUnpin for WindowFunction
impl UnwindSafe for WindowFunction
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
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>
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>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.