Trait PatternLinter

Source
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§

Source

fn pattern(&self) -> &dyn Pattern

A simple getter for the pattern to be searched for.

Source

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.

Source

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.

Implementations on Foreign Types§

Source§

impl<PL: PatternLinter + ?Sized> PatternLinter for Box<PL>

Source§

fn pattern(&self) -> &dyn Pattern

Source§

fn match_to_lint( &self, matched_tokens: &[Token], source: &[char], ) -> Option<Lint>

Source§

fn description(&self) -> &str

Implementors§

Source§

impl PatternLinter for APart

Source§

impl PatternLinter for AskNoPreposition

Source§

impl PatternLinter for BackInTheDay

Source§

impl PatternLinter for BoringWords

Source§

impl PatternLinter for ChockFull

Source§

impl PatternLinter for Confident

Source§

impl PatternLinter for Dashes

Source§

impl PatternLinter for DespiteOf

Source§

impl PatternLinter for DotInitialisms

Source§

impl PatternLinter for ExpandTimeShorthands

Source§

impl PatternLinter for ForNoun

Source§

impl PatternLinter for Hedging

Source§

impl PatternLinter for Hereby

Source§

impl PatternLinter for HowTo

Source§

impl PatternLinter for HyphenateNumberDay

Source§

impl PatternLinter for ItsContraction

Source§

impl PatternLinter for LeftRightHand

Source§

impl PatternLinter for Likewise

Source§

impl PatternLinter for MapPhraseLinter

Source§

impl PatternLinter for ModalOf

Source§

impl PatternLinter for MostNumber

Source§

impl PatternLinter for MultipleSequentialPronouns

Source§

impl PatternLinter for NailOnTheHead

Source§

impl PatternLinter for Nobody

Source§

impl PatternLinter for OfCourse

Source§

impl PatternLinter for OneAndTheSame

Source§

impl PatternLinter for OutOfDate

Source§

impl PatternLinter for Oxymorons

Source§

impl PatternLinter for PiqueInterest

Source§

impl PatternLinter for PossessiveYour

Source§

impl PatternLinter for SaveToSafe

Source§

impl PatternLinter for SomewhatSomething

Source§

impl PatternLinter for ThatWhich

Source§

impl PatternLinter for TheHowWhy

Source§

impl PatternLinter for TheMy

Source§

impl PatternLinter for ThenThan

Source§

impl PatternLinter for UseGenitive

Source§

impl PatternLinter for WasAloud

Source§

impl PatternLinter for Whereas

Source§

impl PatternLinter for WidelyAccepted

Source§

impl PatternLinter for WinPrize