pub struct SetMatches { /* private fields */ }Expand description
Which patterns of a RegexSet matched one text.
Stored as the matching indices rather than as a bit per pattern, because that
is what the engine reports and because the interesting case is a large set
with a few hits. SetMatches::matched therefore costs a binary search
rather than an array index — nothing a caller will measure, and it makes
SetMatches::iter free.
Implementations§
Source§impl SetMatches
impl SetMatches
Sourcepub fn matched_any(&self) -> bool
pub fn matched_any(&self) -> bool
Whether any pattern matched.
Sourcepub fn matched(&self, index: usize) -> bool
pub fn matched(&self, index: usize) -> bool
Whether the pattern at index matched. false for an index past the end
of the set, which cannot have matched anything.
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
How many patterns the set holds — not how many matched. This is
regex’s meaning for the same name; SetMatches::iter counts the hits.
Sourcepub fn iter(
&self,
) -> impl ExactSizeIterator<Item = usize> + DoubleEndedIterator + '_
pub fn iter( &self, ) -> impl ExactSizeIterator<Item = usize> + DoubleEndedIterator + '_
The indices of the patterns that matched, ascending.
Trait Implementations§
Source§impl Clone for SetMatches
impl Clone for SetMatches
Source§fn clone(&self) -> SetMatches
fn clone(&self) -> SetMatches
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SetMatches
impl Debug for SetMatches
impl Eq for SetMatches
Source§impl IntoIterator for SetMatches
impl IntoIterator for SetMatches
Source§impl<'m> IntoIterator for &'m SetMatches
impl<'m> IntoIterator for &'m SetMatches
Source§impl PartialEq for SetMatches
impl PartialEq for SetMatches
impl StructuralPartialEq for SetMatches
Auto Trait Implementations§
impl Freeze for SetMatches
impl RefUnwindSafe for SetMatches
impl Send for SetMatches
impl Sync for SetMatches
impl Unpin for SetMatches
impl UnsafeUnpin for SetMatches
impl UnwindSafe for SetMatches
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
Mutably borrows from an owned value. Read more