Skip to main content

wrapper_events/
line_parser.rs

1use std::error::Error;
2
3use serde_json::Value;
4
5use crate::error::AdapterErrorCode;
6
7pub struct LineInput<'a> {
8    pub line: &'a str,
9    pub json_capture: Option<&'a Value>,
10}
11
12pub trait LineParser {
13    type Event;
14    type Error: ClassifiedParserError;
15
16    fn reset(&mut self);
17    fn parse_line(&mut self, input: LineInput<'_>) -> Result<Option<Self::Event>, Self::Error>;
18}
19
20pub trait ClassifiedParserError: Error {
21    fn code(&self) -> AdapterErrorCode;
22    fn redacted_summary(&self) -> String;
23    fn full_details(&self) -> String;
24}