pub struct Captures<'t, I> { /* private fields */ }
Expand description

Captures represents a group of captured sub-slice for a single match.

The 0th capture always corresponds to the entire match. Each subsequent index corresponds to the next capture group in the regex. If a capture group is named, then the matched sub-slice is also available via the name method. (Note that the 0th capture is always unnamed and so must be accessed with the get method.)

't is the lifetime of the matched slice.

Implementations

Returns the match associated with the capture group at index i. If i does not correspond to a capture group, or if the capture group did not participate in the match, then None is returned.

Returns the match for the capture group named name. If name isn’t a valid capture group or didn’t match anything, then None is returned.

Returns the total number of capture groups (even if they didn’t match). This is always at least 1, since every regex has at least one capture group that corresponds to the full match.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.