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

A representation of “half” of a match reported by a DFA.

This is called a “half” match because it only includes the end location (or start location for a reverse search) of a match. This corresponds to the information that a single DFA scan can report. Getting the other half of the match requires a second scan with a reversed DFA.

A half match also includes the pattern that matched. The pattern is identified by an ID, which corresponds to its position (starting from 0) relative to other patterns used to construct the corresponding DFA. If only a single pattern is provided to the DFA, then all matches are guaranteed to have a pattern ID of 0.

Implementations§

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

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

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

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 DFA. The first pattern has identifier 0, and each subsequent pattern is 1, 2 and so on.

The position of the match.

If this match was produced by a forward search, then the offset is exclusive. If this match was produced by a reverse search, then the offset is inclusive.

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 !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. 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 resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
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.