File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ mod clangll;
56
56
doc_mod ! ( clang) ;
57
57
doc_mod ! ( ir) ;
58
58
doc_mod ! ( parse) ;
59
- mod regex_set;
59
+ doc_mod ! ( regex_set) ;
60
60
61
61
mod codegen {
62
62
include ! ( concat!( env!( "OUT_DIR" ) , "/codegen.rs" ) ) ;
Original file line number Diff line number Diff line change
1
+ //! A type that represents the union of a set of regular expressions.
2
+
1
3
use std:: borrow:: Borrow ;
2
4
use regex:: Regex ;
3
5
4
6
// Yeah, I'm aware this is sorta crappy, should be cheaper to compile a regex
5
7
// ORing all the patterns, I guess...
8
+
9
+ /// A dynamic set of regular expressions.
6
10
#[ derive( Debug ) ]
7
11
pub struct RegexSet {
8
12
items : Vec < Regex >
9
13
}
10
14
11
15
impl RegexSet {
16
+ /// Is this set empty?
12
17
pub fn is_empty ( & self ) -> bool {
13
18
self . items . is_empty ( )
14
19
}
15
20
21
+ /// Extend this set with every regex in the iterator.
16
22
pub fn extend < I > ( & mut self , iter : I )
17
23
where I : IntoIterator < Item =String >
18
24
{
@@ -21,6 +27,7 @@ impl RegexSet {
21
27
}
22
28
}
23
29
30
+ /// Insert a new regex into this set.
24
31
pub fn insert < S > ( & mut self , string : & S )
25
32
where S : Borrow < str >
26
33
{
@@ -35,6 +42,7 @@ impl RegexSet {
35
42
}
36
43
}
37
44
45
+ /// Does the given `string` match any of the regexes in this set?
38
46
pub fn matches < S > ( & self , string : & S ) -> bool
39
47
where S : Borrow < str >
40
48
{
You can’t perform that action at this time.
0 commit comments