pub trait RegexPattern {
type Error;
type Output;
// Required method
fn try_into_regex(self) -> Result<Self::Output, Self::Error>;
// Provided method
fn into_regex(self) -> Self::Output
where Self: Sized,
Self::Error: Debug { ... }
}
Expand description
A trait representing types that can be converted into a compiled Regex
pattern.
This is used by the regex
parser to generically accept either a &str
or an already-compiled
Regex
object. Implementors of this trait can be converted into a Regex
via the
[try_into_regex
] method, allowing flexible API usage.
§Associated Types
Error
: The error type returned if regex compilation fails.
§Required Methods
try_into_regex(self) -> Result<Regex, Self::Error>
: Attempts to compile or convert the input into aRegex
object.