Skip to main content

Matcher

Trait Matcher 

Source
pub trait Matcher<K, C: ?Sized> {
    // Required method
    fn matches(&self, key: &K, context: &C) -> bool;
}
Expand description

Determines whether a command key accepts the current context.

Matching receives only shared references and should not produce application side effects. The selected command receives mutable context and resources only after matching has finished.

Required Methods§

Source

fn matches(&self, key: &K, context: &C) -> bool

Returns true when key identifies the command for context.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<K, C, F> Matcher<K, C> for F
where C: ?Sized, F: Fn(&K, &C) -> bool,

Source§

impl<K, C> Matcher<K, C> for KeyMatcher
where K: PartialEq, C: CommandKey<K>,