Skip to main content

Pattern

Trait Pattern 

Source
pub trait Pattern {
    // Required method
    fn is_matching(&self, val: char) -> bool;
}
Expand description

While https://github.com/rust-lang/rust/issues/27721 is pending we need to define our own minimal Pattern trait.

Pattern typeMatch condition
charis contained in string
&[char]any char in slice is contained in string
F: FnMut(char) -> boolF returns true for a char in string

Required Methods§

Source

fn is_matching(&self, val: char) -> bool

Returns whether the character is matching the pattern.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl Pattern for &[char]

Source§

fn is_matching(&self, val: char) -> bool

Source§

impl Pattern for char

Source§

fn is_matching(&self, val: char) -> bool

Implementors§

Source§

impl<F: Fn(char) -> bool> Pattern for F