Trait Matcher

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

This trait is used for match patterns which are pure, i.e. they have no effect on the current [MatchContext].

Required Methods§

Source

fn try_match<'input, 'context, C>( &self, input: Input<'input>, context: &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, M> Matcher for &'a M
where M: ?Sized + Matcher,

Source§

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

Implementors§