Struct safe_regex::Matcher4 [−][src]
A compiled regular expression with 4 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> Matcher4<F> where
F: for<'d> Fn(&'d [u8]) -> Option<(Option<&'d [u8]>, Option<&'d [u8]>, Option<&'d [u8]>, Option<&'d [u8]>)>, [src]
F: for<'d> Fn(&'d [u8]) -> Option<(Option<&'d [u8]>, Option<&'d [u8]>, Option<&'d [u8]>, Option<&'d [u8]>)>,
#[must_use]pub fn match_all<'d>(
&self,
data: &'d [u8]
) -> Option<(Option<&'d [u8]>, Option<&'d [u8]>, Option<&'d [u8]>, Option<&'d [u8]>)>[src]
&self,
data: &'d [u8]
) -> Option<(Option<&'d [u8]>, Option<&'d [u8]>, Option<&'d [u8]>, Option<&'d [u8]>)>
Executes the regular expression against the byte string data.
Returns Some(T) if the expression matched all of the bytes in data.
The value T is a tuple of captured group slices.
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.
Trait Implementations
impl<F> IsMatch for Matcher4<F> where
F: for<'d> Fn(&'d [u8]) -> Option<(Option<&'d [u8]>, Option<&'d [u8]>, Option<&'d [u8]>, Option<&'d [u8]>)>, [src]
F: for<'d> Fn(&'d [u8]) -> Option<(Option<&'d [u8]>, Option<&'d [u8]>, Option<&'d [u8]>, Option<&'d [u8]>)>,
Auto Trait Implementations
impl<F> RefUnwindSafe for Matcher4<F> where
F: RefUnwindSafe,
F: RefUnwindSafe,
impl<F> Send for Matcher4<F> where
F: Send,
F: Send,
impl<F> Sync for Matcher4<F> where
F: Sync,
F: Sync,
impl<F> Unpin for Matcher4<F> where
F: Unpin,
F: Unpin,
impl<F> UnwindSafe for Matcher4<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>,