pub trait PatternLinter: LSend {
// Required methods
fn pattern(&self) -> &dyn Pattern;
fn match_to_lint(
&self,
matched_tokens: &[Token],
source: &[char],
) -> Option<Lint>;
fn description(&self) -> &str;
}Expand description
A trait that searches for Patterns in Documents.
Makes use of TokenStringExt::iter_chunks to avoid matching across sentence or clause
boundaries.
Required Methods§
Sourcefn match_to_lint(
&self,
matched_tokens: &[Token],
source: &[char],
) -> Option<Lint>
fn match_to_lint( &self, matched_tokens: &[Token], source: &[char], ) -> Option<Lint>
If any portions of a Document match Self::pattern, they are passed through PatternLinter::match_to_lint to be
transformed into a Lint for editor consumption.
This function may return None to elect not to produce a lint.
Sourcefn description(&self) -> &str
fn description(&self) -> &str
A user-facing description of what kinds of grammatical errors this rule looks for. It is usually shown in settings menus.