pub struct Preview {
pub pipeline: Pipeline,
pub original: String,
pub compressed: String,
pub original_tokens: usize,
pub compressed_tokens: usize,
}Expand description
A computed preview: the original, the compressed form lean-ctx would emit, and the token/byte accounting for both.
Fields§
§pipeline: Pipeline§original: String§compressed: String§original_tokens: usize§compressed_tokens: usizeImplementations§
Source§impl Preview
impl Preview
pub fn original_bytes(&self) -> usize
pub fn compressed_bytes(&self) -> usize
Sourcepub fn saved_tokens(&self) -> usize
pub fn saved_tokens(&self) -> usize
Tokens removed. Saturating: a pipeline never inflates in practice, but the accounting stays honest (never negative) if a pathological input did.
Sourcepub fn token_ratio(&self) -> f64
pub fn token_ratio(&self) -> f64
Compressed-to-original token ratio in [0.0, 1.0] (1.0 = no change, also
the empty-input convention). Lower is better.
Auto Trait Implementations§
impl Freeze for Preview
impl RefUnwindSafe for Preview
impl Send for Preview
impl Sync for Preview
impl Unpin for Preview
impl UnsafeUnpin for Preview
impl UnwindSafe for Preview
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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