1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
use super::smtp::{command, session};
pub use super::smtp::{ParseError, ParseResult};
use model::command::{SmtpCommand, SmtpInput};
static PARSER: SmtpParser = SmtpParser;
pub trait Parser {
fn command<'input>(&self, input: &'input str) -> ParseResult<SmtpCommand>;
}
#[derive(Clone)]
pub struct SmtpParser;
impl SmtpParser {
pub fn new() -> SmtpParser {
PARSER.clone()
}
pub fn session<'input>(&self, input: &'input str) -> ParseResult<Vec<SmtpInput>> {
session(input)
}
pub fn command<'input>(&self, input: &'input str) -> ParseResult<SmtpCommand> {
command(input)
}
}
impl Parser for SmtpParser {
fn command<'input>(&self, input: &'input str) -> ParseResult<SmtpCommand> {
self.command(input)
}
}