pub struct TokenBudgetState {
pub window_id: Atomic<usize>,
pub reminder_sent: Atomic<bool>,
/* private fields */
}Expand description
State tracker for the token budget across compaction calls within a single window.
Uses atomics for interior mutability (the
ContextCompaction::compact
method takes &self, not &mut self).
Fields§
§window_id: Atomic<usize>Current window ID (1-indexed, incremented after each reset).
reminder_sent: Atomic<bool>Whether a reminder has been sent in the current window.
Implementations§
Source§impl TokenBudgetState
impl TokenBudgetState
pub fn new() -> TokenBudgetState
Sourcepub fn advance_window(&self) -> usize
pub fn advance_window(&self) -> usize
Advance to the next window and reset per-window state. Returns the new window ID.
pub fn current_window_id(&self) -> usize
pub fn has_sent_reminder(&self) -> bool
pub fn mark_reminder_sent(&self)
Sourcepub fn mark_breath(&self)
pub fn mark_breath(&self)
Record that the current window had a quiet evaluation — real work fits in the room.
pub fn had_breath(&self) -> bool
Sourcepub fn record_breathless_reset(&self) -> usize
pub fn record_breathless_reset(&self) -> usize
Count a reset of a window that never had a quiet turn. Returns the consecutive breathless-reset count (1-indexed).
Sourcepub fn clear_breathless(&self)
pub fn clear_breathless(&self)
A window that did real work was archived — the room is viable; clear the consecutive-breathless counter.
pub fn engage_brake(&self)
pub fn braked(&self) -> bool
Trait Implementations§
Source§impl Default for TokenBudgetState
impl Default for TokenBudgetState
Source§fn default() -> TokenBudgetState
fn default() -> TokenBudgetState
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for TokenBudgetState
impl RefUnwindSafe for TokenBudgetState
impl Send for TokenBudgetState
impl Sync for TokenBudgetState
impl Unpin for TokenBudgetState
impl UnsafeUnpin for TokenBudgetState
impl UnwindSafe for TokenBudgetState
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