Trait MatcherMut

Source
pub trait MatcherMut: Debug + Spanned {
    // Required method
    fn try_match_mut<'input, 'context, C>(
        &self,
        input: Input<'input>,
        context: &mut C,
    ) -> DiagResult<MatchResult<'input>>
       where C: Context<'input, 'context> + ?Sized;
}
Expand description

This trait is used for match patterns which have side effects on the current [MatchContext] when successful.

These matchers may bind new variables, push operands or otherwise modify the match context. Implementors should ensure that such effects are only applied if a match succeeds however, to avoid polluting the match context.

Required Methods§

Source

fn try_match_mut<'input, 'context, C>( &self, input: Input<'input>, context: &mut C, ) -> DiagResult<MatchResult<'input>>
where C: Context<'input, 'context> + ?Sized,

Search for a match in the given input buffer

The first match found is returned.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<'a> MatcherMut for Box<dyn DynMatcher + 'a>

Source§

fn try_match_mut<'input, 'context, C>( &self, input: Input<'input>, context: &mut C, ) -> DiagResult<MatchResult<'input>>
where C: Context<'input, 'context> + ?Sized,

Source§

impl<'a> MatcherMut for Box<dyn DynMatcherMut + 'a>

Source§

fn try_match_mut<'input, 'context, C>( &self, input: Input<'input>, context: &mut C, ) -> DiagResult<MatchResult<'input>>
where C: Context<'input, 'context> + ?Sized,

Source§

impl<'a, M> MatcherMut for &'a M
where M: ?Sized + MatcherMut,

Source§

fn try_match_mut<'input, 'context, C>( &self, input: Input<'input>, context: &mut C, ) -> DiagResult<MatchResult<'input>>
where C: Context<'input, 'context> + ?Sized,

Implementors§