1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
use crate::models::Line;

#[derive(Debug)]
pub enum LineParserError {
    /// This error occurs when we cannot parse the line exhaustively.
    NonExhaustive(String),
    /// This error occurs when a parser detects an error while parsing.
    WithReason(String),
}

pub trait LineParser {
    fn parse_line<'a>(line: &'a str) -> Result<Line<'a>, LineParserError>;
}