pub struct CompressionEngine { /* private fields */ }Expand description
Stateless compression engine.
Instantiated with a CompressionLevel; all formatting calls borrow the
tool slice from the caller rather than owning it.
Implementations§
Source§impl CompressionEngine
impl CompressionEngine
pub fn new(level: CompressionLevel) -> CompressionEngine
Sourcepub fn format_listing(&self, tools: &[Tool]) -> String
pub fn format_listing(&self, tools: &[Tool]) -> String
Format the listing of all tools at the engine’s compression level.
Returns an empty string when the level is Max — callers should expose
a list_tools MCP tool instead.
Otherwise joins individual [format_tool] results with "\n".
Sourcepub fn format_tool(&self, tool: &Tool) -> String
pub fn format_tool(&self, tool: &Tool) -> String
Format a single tool at the engine’s compression level.
See module-level doc for the format rules.
Sourcepub fn get_schema<'a>(&self, tools: &'a [Tool], name: &str) -> Option<&'a Tool>
pub fn get_schema<'a>(&self, tools: &'a [Tool], name: &str) -> Option<&'a Tool>
Look up a tool by name in the provided slice.
Returns None when the name is not found.
Sourcepub fn format_schema_response(tool: &Tool) -> String
pub fn format_schema_response(tool: &Tool) -> String
Build the full schema response string for a tool.
Always uses Low verbosity regardless of the engine’s configured level —
schema lookup is meant to give complete information.
Format:
<tool>name(arg1, arg2): Full description</tool>
{
"type": "object",
"properties": { ... },
...
}Trait Implementations§
Source§impl Clone for CompressionEngine
impl Clone for CompressionEngine
Source§fn clone(&self) -> CompressionEngine
fn clone(&self) -> CompressionEngine
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for CompressionEngine
impl RefUnwindSafe for CompressionEngine
impl Send for CompressionEngine
impl Sync for CompressionEngine
impl Unpin for CompressionEngine
impl UnsafeUnpin for CompressionEngine
impl UnwindSafe for CompressionEngine
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