pub struct FilterStats {
pub raw_chars: usize,
pub filtered_chars: usize,
pub raw_lines: usize,
pub filtered_lines: usize,
pub confidence: Option<FilterConfidence>,
pub command: Option<String>,
pub kept_lines: Vec<usize>,
}Expand description
Cumulative filter statistics for a single tool execution.
Populated by ShellExecutor when output filters are configured.
Displayed in the TUI to show how much output was compacted before being sent to the LLM.
Fields§
§raw_chars: usizeRaw character count before filtering.
filtered_chars: usizeCharacter count after filtering.
raw_lines: usizeRaw line count before filtering.
filtered_lines: usizeLine count after filtering.
confidence: Option<FilterConfidence>Worst-case confidence across all applied filters.
command: Option<String>The shell command that produced this output, for display purposes.
kept_lines: Vec<usize>Zero-based line indices that were kept after filtering.
Implementations§
Source§impl FilterStats
impl FilterStats
Sourcepub fn savings_pct(&self) -> f64
pub fn savings_pct(&self) -> f64
Returns the percentage of characters removed by filtering.
Returns 0.0 when there was no raw output to filter.
Sourcepub fn estimated_tokens_saved(&self) -> usize
pub fn estimated_tokens_saved(&self) -> usize
Estimates the number of LLM tokens saved by filtering.
Uses the 4-chars-per-token approximation. Suitable for logging and metrics, not for billing or exact budget calculations.
Sourcepub fn format_inline(&self, tool_name: &str) -> String
pub fn format_inline(&self, tool_name: &str) -> String
Formats a one-line filter summary for log messages and TUI status.
§Example
use zeph_tools::FilterStats;
let stats = FilterStats {
raw_chars: 1000,
filtered_chars: 400,
raw_lines: 50,
filtered_lines: 20,
command: Some("cargo build".to_owned()),
..Default::default()
};
let summary = stats.format_inline("shell");
assert!(summary.contains("60.0% filtered"));Trait Implementations§
Source§impl Clone for FilterStats
impl Clone for FilterStats
Source§fn clone(&self) -> FilterStats
fn clone(&self) -> FilterStats
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FilterStats
impl Debug for FilterStats
Source§impl Default for FilterStats
impl Default for FilterStats
Source§fn default() -> FilterStats
fn default() -> FilterStats
Auto Trait Implementations§
impl Freeze for FilterStats
impl RefUnwindSafe for FilterStats
impl Send for FilterStats
impl Sync for FilterStats
impl Unpin for FilterStats
impl UnsafeUnpin for FilterStats
impl UnwindSafe for FilterStats
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
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>
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>
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