pub enum PressureLevel {
Low,
Medium,
High,
Critical,
}Expand description
Coarse, UI-facing description of how full the context window is.
Ordered from least to most pressure so the variants can be compared
(level >= PressureLevel::High) and so the derived Ord matches intuition.
Variants§
Low
Plenty of room; nothing to surface.
Medium
Noticeably filling up; informational.
High
At or past the compaction trigger; suggest compaction.
Critical
Near the window limit; compaction/clear is urgent.
Implementations§
Source§impl PressureLevel
impl PressureLevel
Sourcepub fn from_usage_percent(percent: f64) -> Self
pub fn from_usage_percent(percent: f64) -> Self
Classify a window-usage percentage (0.0..=100.0) into a level.
Inputs outside the range are clamped, so callers may pass a raw percentage without pre-validating it.
Sourcepub const fn label(self) -> &'static str
pub const fn label(self) -> &'static str
Lowercase, stable label suitable for status lines and logs.
Kept aligned with the existing context-report vocabulary
(low/moderate/high/critical).
Sourcepub const fn suggests_compaction(self) -> bool
pub const fn suggests_compaction(self) -> bool
Whether this level is at or past the point where compaction should be suggested to the user.
Unused by the engine today; kept as the pressure-level counterpart of
ContextBudget::should_compact so both live next to their thresholds.
Trait Implementations§
Source§impl Clone for PressureLevel
impl Clone for PressureLevel
impl Copy for PressureLevel
Source§impl Debug for PressureLevel
impl Debug for PressureLevel
impl Eq for PressureLevel
Source§impl Hash for PressureLevel
impl Hash for PressureLevel
Source§impl Ord for PressureLevel
impl Ord for PressureLevel
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for PressureLevel
impl PartialEq for PressureLevel
Source§impl PartialOrd for PressureLevel
impl PartialOrd for PressureLevel
impl StructuralPartialEq for PressureLevel
Auto Trait Implementations§
impl Freeze for PressureLevel
impl RefUnwindSafe for PressureLevel
impl Send for PressureLevel
impl Sync for PressureLevel
impl Unpin for PressureLevel
impl UnsafeUnpin for PressureLevel
impl UnwindSafe for PressureLevel
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.