HaystackItem

Trait HaystackItem 

Source
pub trait HaystackItem:
    Debug
    + Default
    + Copy
    + Eq
    + Ord
    + Sealed {
    // Required method
    fn vec_from_str(value: &str) -> Vec<Self>;
}
Expand description

A trait that represents an individual item that can be matched against a Regex. The primary (and only) two implementors 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§

Source

fn vec_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.

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.

Implementations on Foreign Types§

Source§

impl HaystackItem for char

Source§

impl HaystackItem for u8

Implementors§