MailParser

Trait MailParser 

pub trait MailParser: Default {
    // Required method
    fn parse_sync(
        &mut self,
        raw: Vec<Vec<u8>>,
    ) -> ParserResult<Either<RawBody, Mail>>;

    // Provided methods
    fn parse<'a, 'async_trait>(
        &'a mut self,
        stream: impl 'async_trait + Stream<Item = Result<Vec<u8>, ParserError>> + Unpin + Send + 'a,
    ) -> Pin<Box<dyn Future<Output = ParserResult<Either<RawBody, Mail>>> + Send + 'async_trait>>
       where Self: Send + 'async_trait,
             'a: 'async_trait { ... }
    fn convert(self, input: &RawBody) -> ParserResult<Option<Mail>> { ... }
}
Expand description

An abstract mail parser

Required Methods§

fn parse_sync( &mut self, raw: Vec<Vec<u8>>, ) -> ParserResult<Either<RawBody, Mail>>

From a buffer of strings, return either:

§Errors
  • the input is not compliant

Provided Methods§

fn parse<'a, 'async_trait>( &'a mut self, stream: impl 'async_trait + Stream<Item = Result<Vec<u8>, ParserError>> + Unpin + Send + 'a, ) -> Pin<Box<dyn Future<Output = ParserResult<Either<RawBody, Mail>>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'a: 'async_trait,

§Errors
  • the input is not compliant

fn convert(self, input: &RawBody) -> ParserResult<Option<Mail>>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§