Struct safe_regex::Matcher0 [−][src]
A compiled regular expression with no capturing groups.
This is a zero-length type.
The regex!
macro generates a Rust type that implements the regular expression.
This struct holds that type.
Implementations
impl<F> Matcher0<F> where
F: Fn(&[u8]) -> Option<()>,
[src]
F: Fn(&[u8]) -> Option<()>,
#[must_use]pub fn match_all(&self, data: &[u8]) -> Option<()>
[src]
Executes the regular expression against the byte string data
.
Returns Some
if the expression matched all of the bytes in data
.
This is a whole-string match.
For sub-string search, put .*
at the beginning and end of the regex.
Returns None
if the expression did not match data
.
Example
use safe_regex::{regex, IsMatch, Matcher2}; let matcher: Matcher2<_> = regex!(br"([abc])([0-9]*)"); let (prefix, digits) = matcher.match_all(b"a42").unwrap(); assert_eq!(b"a", prefix.unwrap()); assert_eq!(b"42", digits.unwrap());
#[must_use]pub fn new(f: F) -> Self
[src]
This is used internally by the regex!
macro.
This is used internally by the regex!
macro.
Trait Implementations
Auto Trait Implementations
impl<F> RefUnwindSafe for Matcher0<F> where
F: RefUnwindSafe,
F: RefUnwindSafe,
impl<F> Send for Matcher0<F> where
F: Send,
F: Send,
impl<F> Sync for Matcher0<F> where
F: Sync,
F: Sync,
impl<F> Unpin for Matcher0<F> where
F: Unpin,
F: Unpin,
impl<F> UnwindSafe for Matcher0<F> where
F: UnwindSafe,
F: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,