langchain_rust/output_parsers/
output_parser.rs

1use async_trait::async_trait;
2
3use super::OutputParserError;
4
5#[async_trait]
6pub trait OutputParser: Send + Sync {
7    async fn parse(&self, output: &str) -> Result<String, OutputParserError>;
8}
9
10impl<P> From<P> for Box<dyn OutputParser>
11where
12    P: OutputParser + 'static,
13{
14    fn from(parser: P) -> Self {
15        Box::new(parser)
16    }
17}