Struct regex_automata::HalfMatch
source · [−]pub struct HalfMatch { /* private fields */ }
Expand description
A representation 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 match) 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
sourceimpl HalfMatch
impl HalfMatch
sourcepub fn new(pattern: PatternID, offset: usize) -> HalfMatch
pub fn new(pattern: PatternID, offset: usize) -> HalfMatch
Create a new half match from a pattern ID and a byte offset.
sourcepub fn must(pattern: usize, offset: usize) -> HalfMatch
pub fn must(pattern: usize, offset: usize) -> HalfMatch
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
.
Trait Implementations
impl Copy for HalfMatch
impl Eq for HalfMatch
impl StructuralEq for HalfMatch
impl StructuralPartialEq for HalfMatch
Auto Trait Implementations
impl RefUnwindSafe for HalfMatch
impl Send for HalfMatch
impl Sync for HalfMatch
impl Unpin for HalfMatch
impl UnwindSafe for HalfMatch
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more