ResponseParser

Trait ResponseParser 

Source
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§

Source

fn parse(&self, content: &str) -> Result<T, ParseError>

Parse response content into target type

Source

fn extract_content(&self, text: &str) -> String

Extract content using configured strategies

Source

fn fallback_parse( &self, content: &str, error: &ParseError, ) -> Result<T, ParseError>

Fallback parsing when primary parsing fails

Implementors§