Matcheable

Trait Matcheable 

Source
pub trait Matcheable: Sized {
    // Required methods
    fn search_fwd(
        &self,
        pat: impl RegexPattern,
        range: impl RangeBounds<usize> + Clone,
    ) -> Result<impl Iterator<Item = (Range<usize>, &str)>, Box<Error>>;
    fn search_rev(
        &self,
        pat: impl RegexPattern,
        range: impl RangeBounds<usize> + Clone,
    ) -> Result<impl Iterator<Item = (Range<usize>, &str)>, Box<Error>>;
    fn reg_matches(
        &self,
        pat: impl RegexPattern,
        range: impl RangeBounds<usize> + Clone,
    ) -> Result<bool, Box<Error>>;
}
Expand description

A trait to match regexes on &strs

Required Methods§

Source

fn search_fwd( &self, pat: impl RegexPattern, range: impl RangeBounds<usize> + Clone, ) -> Result<impl Iterator<Item = (Range<usize>, &str)>, Box<Error>>

Returns a forward Iterator over matches of a given regex

Source

fn search_rev( &self, pat: impl RegexPattern, range: impl RangeBounds<usize> + Clone, ) -> Result<impl Iterator<Item = (Range<usize>, &str)>, Box<Error>>

Returns a backwards Iterator over matches of a given regex

Source

fn reg_matches( &self, pat: impl RegexPattern, range: impl RangeBounds<usize> + Clone, ) -> Result<bool, Box<Error>>

Checks if a type matches a RegexPattern

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.

Implementors§

Source§

impl<S: AsRef<str>> Matcheable for S