pub struct MultiMatch { /* private fields */ }
Expand description

A representation of a multi match reported by a regex engine.

A multi match has two essential pieces of information: the identifier of the pattern that matched, along with the start and end offsets of the match in the haystack.

The pattern is identified by an ID, which corresponds to its position (starting from 0) relative to other patterns used to construct the corresponding regex engine. If only a single pattern is provided, then all multi matches are guaranteed to have a pattern ID of 0.

Every multi match guarantees that start <= end.

Implementations

Create a new match from a pattern ID and a byte offset span.

Panics

This panics if end < start.

Create a new match from a pattern ID and a byte offset span.

This is like MultiMatch::new, but accepts a usize instead of a PatternID. This panics if the given usize is not representable as a PatternID.

Panics

This panics if end < start or if pattern > PatternID::MAX.

Returns the ID of the pattern that matched.

The ID of a pattern is derived from the position in which it was originally inserted into the corresponding regex engine. The first pattern has identifier 0, and each subsequent pattern is 1, 2 and so on.

The starting position of the match.

The ending position of the match.

Returns the match location as a range.

Returns true if and only if this match is empty. That is, when start() == end().

An empty match can only be returned when the empty string was among the patterns used to build the Aho-Corasick automaton.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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 resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

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.