pub(super) trait WindowImpl {
type Key: Ord;
type Value: Clone;
// Required methods
fn preceding_saturated(
&self,
window: BufferRef<'_, Self::Key, Self::Value>,
) -> bool;
fn following_saturated(
&self,
window: BufferRef<'_, Self::Key, Self::Value>,
) -> bool;
fn recalculate_left_right(
&mut self,
window: BufferRefMut<'_, Self::Key, Self::Value>,
hint: RecalculateHint,
);
fn shift_indices(&mut self, n: usize);
// Provided methods
fn closed_by_input(
&self,
window: BufferRef<'_, Self::Key, Self::Value>,
) -> bool { ... }
fn watermark_bound(
&self,
_window: BufferRef<'_, Self::Key, Self::Value>,
) -> Option<WatermarkBound> { ... }
}Expand description
A trait for sliding window implementations. This trait is used by WindowBuffer to
determine the status of current window and how to slide the window.
Required Associated Types§
Required Methods§
Sourcefn preceding_saturated(
&self,
window: BufferRef<'_, Self::Key, Self::Value>,
) -> bool
fn preceding_saturated( &self, window: BufferRef<'_, Self::Key, Self::Value>, ) -> bool
Whether the preceding half of the current window is saturated. By “saturated” we mean that every row that is possible to be in the preceding half of the current window is already in the buffer.
Sourcefn following_saturated(
&self,
window: BufferRef<'_, Self::Key, Self::Value>,
) -> bool
fn following_saturated( &self, window: BufferRef<'_, Self::Key, Self::Value>, ) -> bool
Whether the following half of the current window is saturated.
Sourcefn recalculate_left_right(
&mut self,
window: BufferRefMut<'_, Self::Key, Self::Value>,
hint: RecalculateHint,
)
fn recalculate_left_right( &mut self, window: BufferRefMut<'_, Self::Key, Self::Value>, hint: RecalculateHint, )
Recalculate the left and right indices of the current window, according to the latest
curr_idx and the hint.
Sourcefn shift_indices(&mut self, n: usize)
fn shift_indices(&mut self, n: usize)
Shift the indices stored by the WindowImpl by n positions. This should be called
after evicting rows from the buffer.
Provided Methods§
Sourcefn closed_by_input(&self, window: BufferRef<'_, Self::Key, Self::Value>) -> bool
fn closed_by_input(&self, window: BufferRef<'_, Self::Key, Self::Value>) -> bool
Whether the current row exists and its window is closed by the rows in the buffer, given that no future row is less than the last one in the order of the order key.
Sourcefn watermark_bound(
&self,
_window: BufferRef<'_, Self::Key, Self::Value>,
) -> Option<WatermarkBound>
fn watermark_bound( &self, _window: BufferRef<'_, Self::Key, Self::Value>, ) -> Option<WatermarkBound>
The watermark of the order key that closes the current window, called only when the
current row exists and its window is not closed by input. None means only future rows
can close it, which is also the case for a non-ascending order, since a watermark only
bounds future order values from below.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".