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§
source§impl 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 StructuralPartialEq for HalfMatch
Auto Trait Implementations§
impl Freeze for HalfMatch
impl RefUnwindSafe for HalfMatch
impl Send for HalfMatch
impl Sync for HalfMatch
impl Unpin for HalfMatch
impl UnwindSafe for HalfMatch
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)