#[non_exhaustive]pub enum CompactionTrigger {
TurnCount(usize),
TokenCount(usize),
Any(Box<CompactionTrigger>, Box<CompactionTrigger>),
All(Box<CompactionTrigger>, Box<CompactionTrigger>),
}Expand description
When to compact. Checked before every plan() round.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
TurnCount(usize)
Compact when the number of accumulated steps (turns) exceeds turns.
TokenCount(usize)
Compact when the cumulative reported token usage exceeds tokens.
Agents that do not report tokens never trigger this variant (use
TurnCount or pair with Any).
Any(Box<CompactionTrigger>, Box<CompactionTrigger>)
Compact when either sub-trigger fires.
All(Box<CompactionTrigger>, Box<CompactionTrigger>)
Compact when both sub-triggers fire.
Implementations§
Source§impl CompactionTrigger
impl CompactionTrigger
Sourcepub fn should_compact(&self, turns: usize, tokens: usize) -> bool
pub fn should_compact(&self, turns: usize, tokens: usize) -> bool
Whether the trigger fires at (turns, tokens).
Trait Implementations§
Source§impl Clone for CompactionTrigger
impl Clone for CompactionTrigger
Source§fn clone(&self) -> CompactionTrigger
fn clone(&self) -> CompactionTrigger
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 moreAuto Trait Implementations§
impl Freeze for CompactionTrigger
impl RefUnwindSafe for CompactionTrigger
impl Send for CompactionTrigger
impl Sync for CompactionTrigger
impl Unpin for CompactionTrigger
impl UnsafeUnpin for CompactionTrigger
impl UnwindSafe for CompactionTrigger
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