pub trait ResponseParser<T> {
// Required methods
fn parse(&self, content: &str) -> Result<T, ParseError>;
fn extract_content(&self, text: &str) -> String;
fn fallback_parse(
&self,
content: &str,
error: &ParseError,
) -> Result<T, ParseError>;
}Expand description
Core trait for response parsing
Required Methods§
Sourcefn parse(&self, content: &str) -> Result<T, ParseError>
fn parse(&self, content: &str) -> Result<T, ParseError>
Parse response content into target type
Sourcefn extract_content(&self, text: &str) -> String
fn extract_content(&self, text: &str) -> String
Extract content using configured strategies
Sourcefn fallback_parse(
&self,
content: &str,
error: &ParseError,
) -> Result<T, ParseError>
fn fallback_parse( &self, content: &str, error: &ParseError, ) -> Result<T, ParseError>
Fallback parsing when primary parsing fails