noa_parser/matcher.rs
1//! Provides the `Match` trait.
2
3/// Describes a matchable object.
4pub trait Match<T> {
5 /// Returns true if the data matches the pattern.
6 ///
7 /// # Arguments
8 /// data - the data to match
9 ///
10 /// # Returns
11 /// (true, index) if the data matches the pattern,
12 /// (false, index) otherwise
13 fn matcher(&self, data: &[T]) -> (bool, usize);
14}
15
16/// Size of the matchable object.
17pub trait MatchSize {
18 /// Returns the size of the matchable object.
19 fn size(&self) -> usize;
20}