pub trait HaystackItem:
Debug
+ Default
+ Copy
+ Eq
+ Ord
+ Sealed {
// Required methods
fn collect_from_str(value: &str) -> Vec<Self>;
fn collect_from_bytes(value: &[u8]) -> Vec<Self>;
fn is_newline(self) -> bool;
fn is_return(self) -> bool;
}Expand description
A trait that represents an individual item that can be matched against a
Regex. The primary (and only) two implementers are char and u8.
§Sealed
This trait is sealed, preventing implementations because the regex! macro can’t produce
Regex types that match against any HaystackItem other than the default. If you need to match
against another item type and want to use this crate, you may as well fork it so that you don’t
have to write manual Matcher expressions.
Required Methods§
Sourcefn collect_from_str(value: &str) -> Vec<Self>
fn collect_from_str(value: &str) -> Vec<Self>
Creates a Vec of this item from the provided &str, used to convert string literals from
parsed regular expressions into individual HaystackItems that can be matched in a
haystack.
Sourcefn collect_from_bytes(value: &[u8]) -> Vec<Self>
fn collect_from_bytes(value: &[u8]) -> Vec<Self>
Creates a Vec of this item from the provided &[u8], used to convert a series of bytes to
match from parsed regular expressions into individual HaystackItems.
Sourcefn is_newline(self) -> bool
fn is_newline(self) -> bool
Check is this item is a newline character (‘\n’ or b’\n’). Used for string and line anchoring.
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.