Struct safe_regex::Matcher5[][src]

pub struct Matcher5<F> where
    F: for<'d> Fn(&'d [u8]) -> Option<(Option<&'d [u8]>, Option<&'d [u8]>, Option<&'d [u8]>, Option<&'d [u8]>, Option<&'d [u8]>)>, 
{ /* fields omitted */ }

A compiled regular expression with 5 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> Matcher5<F> where
    F: for<'d> Fn(&'d [u8]) -> Option<(Option<&'d [u8]>, Option<&'d [u8]>, Option<&'d [u8]>, Option<&'d [u8]>, Option<&'d [u8]>)>, 
[src]

#[must_use]pub fn match_all<'d>(
    &self,
    data: &'d [u8]
) -> Option<(Option<&'d [u8]>, Option<&'d [u8]>, Option<&'d [u8]>, Option<&'d [u8]>, Option<&'d [u8]>)>
[src]

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 Matcher5<F> where
    F: for<'d> Fn(&'d [u8]) -> Option<(Option<&'d [u8]>, Option<&'d [u8]>, Option<&'d [u8]>, Option<&'d [u8]>, Option<&'d [u8]>)>, 
[src]

Auto Trait Implementations

impl<F> RefUnwindSafe for Matcher5<F> where
    F: RefUnwindSafe

impl<F> Send for Matcher5<F> where
    F: Send

impl<F> Sync for Matcher5<F> where
    F: Sync

impl<F> Unpin for Matcher5<F> where
    F: Unpin

impl<F> UnwindSafe for Matcher5<F> where
    F: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.