pub struct ContextLedger {
pub window_size: usize,
pub entries: Vec<LedgerEntry>,
pub total_tokens_sent: usize,
pub total_tokens_saved: usize,
}Fields§
§window_size: usize§entries: Vec<LedgerEntry>§total_tokens_sent: usize§total_tokens_saved: usizeImplementations§
Source§impl ContextLedger
impl ContextLedger
pub fn new() -> Self
pub fn with_window_size(size: usize) -> Self
pub fn record( &mut self, path: &str, mode: &str, original_tokens: usize, sent_tokens: usize, )
pub fn pressure(&self) -> ContextPressure
pub fn compression_ratio(&self) -> f64
pub fn files_by_token_cost(&self) -> Vec<(String, usize)>
pub fn mode_distribution(&self) -> HashMap<String, usize>
pub fn eviction_candidates(&self, keep_count: usize) -> Vec<String>
pub fn remove(&mut self, path: &str)
pub fn save(&self)
pub fn load() -> Self
pub fn format_summary(&self) -> String
Source§impl ContextLedger
impl ContextLedger
pub fn reinjection_plan( &self, intent: &StructuredIntent, target_utilization: f64, ) -> ReinjectionPlan
Trait Implementations§
Source§impl Clone for ContextLedger
impl Clone for ContextLedger
Source§fn clone(&self) -> ContextLedger
fn clone(&self) -> ContextLedger
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ContextLedger
impl Debug for ContextLedger
Source§impl Default for ContextLedger
impl Default for ContextLedger
Source§impl<'de> Deserialize<'de> for ContextLedger
impl<'de> Deserialize<'de> for ContextLedger
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ContextLedger
impl RefUnwindSafe for ContextLedger
impl Send for ContextLedger
impl Sync for ContextLedger
impl Unpin for ContextLedger
impl UnsafeUnpin for ContextLedger
impl UnwindSafe for ContextLedger
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more