pub struct ParserRegistry { /* private fields */ }Expand description
Registry for model-specific 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 register_pattern(&self, pattern: &str, parser_name: &str)
pub fn register_pattern(&self, pattern: &str, parser_name: &str)
Register a model pattern to parser mapping. Patterns are checked in order, first match wins.
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 ReasoningParser>>
pub fn create_parser(&self, name: &str) -> Option<Box<dyn ReasoningParser>>
Create a fresh parser instance by exact name (not pooled). Returns a new parser instance for each call - useful for streaming where state isolation is needed.
Sourcepub fn find_pooled_parser_for_model(
&self,
model_id: &str,
) -> Option<PooledParser>
pub fn find_pooled_parser_for_model( &self, model_id: &str, ) -> Option<PooledParser>
Find a pooled parser for a given model ID by pattern matching.
Sourcepub fn has_parser_for_model(&self, model_id: &str) -> bool
pub fn has_parser_for_model(&self, model_id: &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_id: &str,
) -> Option<Box<dyn ReasoningParser>>
pub fn create_for_model( &self, model_id: &str, ) -> Option<Box<dyn ReasoningParser>>
Create a fresh parser instance for a given model ID by pattern matching (not pooled). Returns a new parser instance for each call - useful for streaming where state isolation is needed.
Sourcepub fn clear_pool(&self)
pub fn clear_pool(&self)
Clear the parser pool, forcing new instances to be created. Useful for testing or when parsers need to be reset globally.
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 more