pub struct SlidingWindow {
pub window: usize,
pub preserve_first_user: bool,
}Expand description
Keep leading system message(s) + the last window non-system messages.
Mirrors upstream’s SlidingWindow strategy.
Fields§
§window: usize§preserve_first_user: boolImplementations§
Source§impl SlidingWindow
impl SlidingWindow
pub fn new(window: usize) -> SlidingWindow
Sourcepub fn preserve_first_user(self) -> SlidingWindow
pub fn preserve_first_user(self) -> SlidingWindow
Also retain the earliest user message, whatever the window size — see
Truncation::preserve_first_user, which this mirrors.
Upstream added the option to its truncation strategy only; it is offered here on every strategy that drops the oldest turns, because the exposure it addresses is identical in each and a caller’s choice between them is about how to bound context, not about whether the opening request matters.
Trait Implementations§
Source§impl Clone for SlidingWindow
impl Clone for SlidingWindow
Source§fn clone(&self) -> SlidingWindow
fn clone(&self) -> SlidingWindow
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl CompactionStrategy for SlidingWindow
impl CompactionStrategy for SlidingWindow
impl Copy for SlidingWindow
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