pub trait PatternLinter {
// Required methods
fn pattern(&self) -> &dyn Pattern;
fn match_to_lint(&self, matched_tokens: &[Token], source: &[char]) -> Lint;
fn description(&self) -> &str;
}
Expand description
A trait that searches for Pattern
s in Document
s.
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]) -> Lint
fn match_to_lint(&self, matched_tokens: &[Token], source: &[char]) -> 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.
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.