pub trait RegExp: Sized {
// Required methods
fn syntax() -> RegexSyntax;
fn parse(pattern: &str, flags: &str) -> Result<Self, ()>;
fn matches<'a>(&self, text: &'a str) -> Option<Vec<Option<&'a str>>>;
}
Required Methods§
fn syntax() -> RegexSyntax
Sourcefn parse(pattern: &str, flags: &str) -> Result<Self, ()>
fn parse(pattern: &str, flags: &str) -> Result<Self, ()>
Generates a regexp pattern for the given string. If the pattern is invalid, the parse function should return an error.
Sourcefn matches<'a>(&self, text: &'a str) -> Option<Vec<Option<&'a str>>>
fn matches<'a>(&self, text: &'a str) -> Option<Vec<Option<&'a str>>>
Matches the given text against the regular expression and returns the list
of captures. The matches are returned in the order they appear in the
regular expression. It is not prefixed with the full match. For groups
that occur in the regular expression, but did not match, the corresponding
capture should be None
.
Returns None
if the text does not match the regular expression.
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.