pub struct ExprMap<T>where
T: LSend,{ /* private fields */ }
Expand description
A map from an Expr
to arbitrary data.
It has been a common pattern for rule authors to build a list of expressions that match a grammatical error. Then, depending on which expression was matched, a suggestion is chosen from another list.
The ExprMap
unifies these two lists into one.
A great example of this is the PronounInfectionBe
rule.
It builds a list of incorrect PRONOUN + BE
combinations, alongside their corrections.
When used as a Expr
in and of itself, it simply iterates through
all contained expressions, returning the first match found.
You should not assume this search is deterministic.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for ExprMap<T>
impl<T> !RefUnwindSafe for ExprMap<T>
impl<T> !Send for ExprMap<T>
impl<T> !Sync for ExprMap<T>
impl<T> Unpin for ExprMap<T>where
T: Unpin,
impl<T> !UnwindSafe for ExprMap<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<E> ExprExt for E
impl<E> ExprExt for E
Source§fn iter_matches<'a>(
&'a self,
tokens: &'a [Token],
source: &'a [char],
) -> Box<dyn Iterator<Item = Span> + 'a>
fn iter_matches<'a>( &'a self, tokens: &'a [Token], source: &'a [char], ) -> Box<dyn Iterator<Item = Span> + 'a>
Iterate over all matches of this expression in the document, automatically filtering out
overlapping matches, preferring the first.
fn iter_matches_in_doc<'a>( &'a self, doc: &'a Document, ) -> Box<dyn Iterator<Item = Span> + 'a>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more