Struct regex::SetMatches
source · [−]pub struct SetMatches { /* private fields */ }
Expand description
A set of matches returned by a regex set.
Implementations
sourceimpl SetMatches
impl SetMatches
sourcepub fn matched_any(&self) -> bool
pub fn matched_any(&self) -> bool
Whether this set contains any matches.
sourcepub fn matched(&self, regex_index: usize) -> bool
pub fn matched(&self, regex_index: usize) -> bool
Whether the regex at the given index matched.
The index for a regex is determined by its insertion order upon the
initial construction of a RegexSet
, starting at 0
.
Panics
If regex_index
is greater than or equal to self.len()
.
sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
The total number of regexes in the set that created these matches.
WARNING: This always returns the same value as RegexSet::len
.
In particular, it does not return the number of elements yielded by
SetMatches::iter
. The only way to determine the total number of
matched regexes is to iterate over them.
sourcepub fn iter(&self) -> SetMatchesIter<'_>ⓘNotable traits for SetMatchesIter<'a>impl<'a> Iterator for SetMatchesIter<'a> type Item = usize;
pub fn iter(&self) -> SetMatchesIter<'_>ⓘNotable traits for SetMatchesIter<'a>impl<'a> Iterator for SetMatchesIter<'a> type Item = usize;
Returns an iterator over indexes in the regex that matched.
This will always produces matches in ascending order of index, where the index corresponds to the index of the regex that matched with respect to its position when initially building the set.
Trait Implementations
sourceimpl Clone for SetMatches
impl Clone for SetMatches
sourcefn clone(&self) -> SetMatches
fn clone(&self) -> SetMatches
1.0.0const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read more