pub struct Reading {
pub used: Option<u64>,
pub denominator: usize,
pub marker: Option<f64>,
}Expand description
One reading of the context bar: what was used, out of what, with the tripwire where the compaction policy puts it.
used is None before the first turn, which is not the same as zero: a bar that is 0% full
and a bar that has not been measured look identical, and only one of them is a fact.
Fields§
§used: Option<u64>Tokens in the last assembled prompt. The server’s own count when it gave one, else the runtime’s estimate from characters.
denominator: usizeThe model’s window where it is known, else the configured rail, else 0 for “nobody stated a number”.
marker: Option<f64>Where compaction starts, as a share of the denominator. None when it is off or unknown.
Implementations§
Source§impl Reading
impl Reading
pub fn new(used: Option<u64>, denominator: usize, marker: Option<f64>) -> Self
The fill as a share of the window. None when there is nothing to be a share of.
Sourcepub fn passed(&self) -> bool
pub fn passed(&self) -> bool
Whether the prompt has gone past the tripwire. False when there is no tripwire.
Sourcepub fn bar(&self, width: usize) -> String
pub fn bar(&self, width: usize) -> String
The bar itself, width cells wide. Never empty: before the first turn it is the empty
bar with the tripwire on it, which is what the terminal has always drawn.
Sourcepub fn pieces(&self, width: usize) -> Pieces
pub fn pieces(&self, width: usize) -> Pieces
The read-out’s parts, for a surface that colours them differently: 12.3K/328K, the bar
with its tripwire, 4%, and — when nobody stated a denominator — the reason there is no
bar instead of a bar against a number the model was never told.
Sourcepub fn text(&self, width: usize) -> String
pub fn text(&self, width: usize) -> String
The whole read-out in words: ctx 12.3K/328K ██░░░░░░│░░ 4%, ctx --/328K ░░░░░░░░│░
before the first turn, or a plain token count when nobody stated a denominator.
The three surfaces read this, and the two that draw colour read Self::pieces, so none
of them can drift into a second opinion about a percentage.