pub struct ParserRegistry { /* private fields */ }Expand description
Registry for model-specific tool parsers with pooling support.
Implementations§
Source§impl ParserRegistry
impl ParserRegistry
Sourcepub fn register_parser<F>(&self, name: &str, creator: F)
pub fn register_parser<F>(&self, name: &str, creator: F)
Register a parser creator for a given parser type.
Sourcepub fn map_model(&self, model: impl Into<String>, parser: impl Into<String>)
pub fn map_model(&self, model: impl Into<String>, parser: impl Into<String>)
Map a model name/pattern to a parser
Sourcepub fn get_pooled_parser(&self, name: &str) -> Option<PooledParser>
pub fn get_pooled_parser(&self, name: &str) -> Option<PooledParser>
Get a pooled parser by exact name. Returns a shared parser instance from the pool, creating one if needed.
Sourcepub fn has_parser(&self, name: &str) -> bool
pub fn has_parser(&self, name: &str) -> bool
Check if a parser with the given name is registered.
Sourcepub fn create_parser(&self, name: &str) -> Option<Box<dyn ToolParser>>
pub fn create_parser(&self, name: &str) -> Option<Box<dyn ToolParser>>
Create a fresh (non-pooled) parser instance by exact name. Returns a new parser instance for each call - useful for streaming where state isolation is needed.
Sourcepub fn has_parser_for_model(&self, model: &str) -> bool
pub fn has_parser_for_model(&self, model: &str) -> bool
Check if a parser can be created for a specific model without actually creating it. Returns true if a parser is available (registered) for this model.
Sourcepub fn create_for_model(&self, model: &str) -> Option<Box<dyn ToolParser>>
pub fn create_for_model(&self, model: &str) -> Option<Box<dyn ToolParser>>
Create a fresh (non-pooled) parser instance for a specific model. Returns a new parser instance for each call - useful for streaming where state isolation is needed.
Sourcepub fn get_pooled_for_model(&self, model: &str) -> Option<PooledParser>
pub fn get_pooled_for_model(&self, model: &str) -> Option<PooledParser>
Get parser for a specific model
Sourcepub fn clear_pool(&self)
pub fn clear_pool(&self)
Clear the parser pool, forcing new instances to be created.
Sourcepub fn set_default_parser(&self, name: impl Into<String>)
pub fn set_default_parser(&self, name: impl Into<String>)
Set the default parser
Trait Implementations§
Source§impl Clone for ParserRegistry
impl Clone for ParserRegistry
Source§fn clone(&self) -> ParserRegistry
fn clone(&self) -> ParserRegistry
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ParserRegistry
impl !RefUnwindSafe for ParserRegistry
impl Send for ParserRegistry
impl Sync for ParserRegistry
impl Unpin for ParserRegistry
impl UnsafeUnpin for ParserRegistry
impl !UnwindSafe for ParserRegistry
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