pub trait Parser: Send + Sync {
// Required methods
fn name(&self) -> &'static str;
fn should_apply(&self, context: &ParsingContext<'_>) -> bool;
fn parse(&self, context: &ParsingContext<'_>) -> Result<Vec<ParsedResult>>;
}Expand description
Trait implemented by individual date/time parsers.
Required Methods§
Sourcefn should_apply(&self, context: &ParsingContext<'_>) -> bool
fn should_apply(&self, context: &ParsingContext<'_>) -> bool
Check if this parser should run on the given context This is a fast pre-filter to skip parsers that won’t match
Sourcefn parse(&self, context: &ParsingContext<'_>) -> Result<Vec<ParsedResult>>
fn parse(&self, context: &ParsingContext<'_>) -> Result<Vec<ParsedResult>>
Parse the text and return all matches