File tree 2 files changed +36
-0
lines changed
2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -482,6 +482,24 @@ impl SetMatches {
482
482
!self . 0 . is_empty ( )
483
483
}
484
484
485
+ /// Whether all patterns in this set matched.
486
+ ///
487
+ /// # Example
488
+ ///
489
+ /// ```
490
+ /// use regex::bytes::RegexSet;
491
+ ///
492
+ /// let set = RegexSet::new(&[
493
+ /// r"^foo",
494
+ /// r"[a-z]+\.com",
495
+ /// ]).unwrap();
496
+ /// let matches = set.matches(b"foo.example.com");
497
+ /// assert!(matches.matched_all());
498
+ /// ```
499
+ pub fn matched_all ( & self ) -> bool {
500
+ self . 0 . is_full ( )
501
+ }
502
+
485
503
/// Whether the regex at the given index matched.
486
504
///
487
505
/// The index for a regex is determined by its insertion order upon the
Original file line number Diff line number Diff line change @@ -478,6 +478,24 @@ impl SetMatches {
478
478
!self . 0 . is_empty ( )
479
479
}
480
480
481
+ /// Whether all patterns in this set matched.
482
+ ///
483
+ /// # Example
484
+ ///
485
+ /// ```
486
+ /// use regex::RegexSet;
487
+ ///
488
+ /// let set = RegexSet::new(&[
489
+ /// r"^foo",
490
+ /// r"[a-z]+\.com",
491
+ /// ]).unwrap();
492
+ /// let matches = set.matches("foo.example.com");
493
+ /// assert!(matches.matched_all());
494
+ /// ```
495
+ pub fn matched_all ( & self ) -> bool {
496
+ self . 0 . is_full ( )
497
+ }
498
+
481
499
/// Whether the regex at the given index matched.
482
500
///
483
501
/// The index for a regex is determined by its insertion order upon the
You can’t perform that action at this time.
0 commit comments