[][src]Struct regress::Match

pub struct Match {
    pub total_range: Range,
    pub captures: Vec<Option<Range>>,
}

A Match represents a portion of a string which was found to match a Regex.

Fields

total_range: Range

The total range of the match. Note this may be empty, if the regex matched an empty string.

captures: Vec<Option<Range>>

The list of captures. This has length equal to the number of capturing groups in the regex. For each capture, if the value is None, that group did not match (for example, it was in a not-taken branch of an alternation). If the value is Some, the group did match with the enclosed range.

Implementations

impl Match[src]

pub fn group(&self, idx: usize) -> Option<Range>[src]

Access a group by index, using the convention of Python's group() function. Index 0 is the total match, index 1 is the first capture group.

pub fn total(&self) -> Range[src]

Return the total range. This is a convenience function to work around the fact that Range does not support Copy.

Trait Implementations

impl Clone for Match[src]

impl Debug for Match[src]

Auto Trait Implementations

impl RefUnwindSafe for Match

impl Send for Match

impl Sync for Match

impl Unpin for Match

impl UnwindSafe for Match

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.