pub struct SymbolicEncoder { /* private fields */ }Expand description
Production encoder backed by a Measurer for token accounting.
Implementations§
Source§impl SymbolicEncoder
impl SymbolicEncoder
Sourcepub fn compress_traced(
&self,
input: &str,
model: Model,
) -> (Compressed, EncoderTrace)
pub fn compress_traced( &self, input: &str, model: Model, ) -> (Compressed, EncoderTrace)
Compress + return the per-rule firing trace alongside the
Compressed output. The proxy / MCP server / Python SDK feed
EncoderTrace into the audit ledger so post-hoc analysis can
answer questions like “which rules pulled their weight on
production traffic in 2026-W17?”.
On Prose fallback the trace is empty (EncoderTrace::default)
because the pipeline never ran.
Sourcepub fn compress_traced_with(
&self,
input: &str,
model: Model,
rs: &RuleSet,
) -> (Compressed, EncoderTrace)
pub fn compress_traced_with( &self, input: &str, model: Model, rs: &RuleSet, ) -> (Compressed, EncoderTrace)
Same as [compress_traced] but consults the supplied
RuleSet instead of the v1 defaults. Intended for the
hot-reload path: the proxy reads the current ruleset under a
read lock and passes a &RuleSet per request.
Trait Implementations§
Source§impl Encoder for SymbolicEncoder
impl Encoder for SymbolicEncoder
Source§fn compress(&self, input: &str, model: Model) -> Compressed
fn compress(&self, input: &str, model: Model) -> Compressed
Compress
input for the target model. Must run in <5ms at p95.
Returns Compressed even on fallback; format field reports what was used.Source§fn select_format(&self, input: &str, model: Model) -> Format
fn select_format(&self, input: &str, model: Model) -> Format
Pick the best format for
input without actually encoding. Used by
A/B samplers and planners. Must match [compress]’s selection.Source§fn fallback(
&self,
input: &str,
model: Model,
reason: FallbackReason,
) -> Compressed
fn fallback( &self, input: &str, model: Model, reason: FallbackReason, ) -> Compressed
Explicit fallback request — used when downstream quality monitor flags
a previously-compressed payload.
Auto Trait Implementations§
impl Freeze for SymbolicEncoder
impl !RefUnwindSafe for SymbolicEncoder
impl Send for SymbolicEncoder
impl Sync for SymbolicEncoder
impl Unpin for SymbolicEncoder
impl UnsafeUnpin for SymbolicEncoder
impl !UnwindSafe for SymbolicEncoder
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> 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