pub trait Parser: Send + Sync {
// Required methods
fn pattern(&self, context: &ParsingContext) -> JsRegex;
fn extract(&self, context: &ParsingContext, m: &mut RegexMatch) -> Extracted;
}Expand description
upstream Parser.
Required Methods§
Sourcefn pattern(&self, context: &ParsingContext) -> JsRegex
fn pattern(&self, context: &ParsingContext) -> JsRegex
pattern(context). Return a clone of a cached regex; cloning is cheap.
Sourcefn extract(&self, context: &ParsingContext, m: &mut RegexMatch) -> Extracted
fn extract(&self, context: &ParsingContext, m: &mut RegexMatch) -> Extracted
extract(context, match). m.index is the byte offset of the match in context.text.
Like upstream, an extractor may move m.index before returning Extracted::None to
control where the search resumes.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".