Skip to main content

Pattern

Trait Pattern 

Source
pub trait Pattern {
    // Required methods
    fn matches(&self, window: &[u8]) -> bool;
    fn len(&self) -> usize;

    // Provided method
    fn is_empty(&self) -> bool { ... }
}
Expand description

A trait for types that can be searched for within a byte slice

Required Methods§

Source

fn matches(&self, window: &[u8]) -> bool

Returns true if the pattern matches the given window of bytes

Source

fn len(&self) -> usize

Returns the length of the pattern

Provided Methods§

Source

fn is_empty(&self) -> bool

Checks if the pattern is empty (has a length of 0)

Implementors§

Source§

impl<'a> Pattern for BasePattern<'a>

Source§

impl<'a> Pattern for MaskedPattern<'a>