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);
}
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.