@@ -6,7 +6,7 @@ use std::cell::Cell;
6
6
7
7
/// A dynamic set of regular expressions.
8
8
#[ derive( Clone , Debug , Default ) ]
9
- pub struct RegexSet {
9
+ pub ( crate ) struct RegexSet {
10
10
items : Vec < Box < str > > ,
11
11
/// Whether any of the items in the set was ever matched. The length of this
12
12
/// vector is exactly the length of `items`.
@@ -17,18 +17,13 @@ pub struct RegexSet {
17
17
}
18
18
19
19
impl RegexSet {
20
- /// Create a new RegexSet
21
- pub fn new ( ) -> RegexSet {
22
- RegexSet :: default ( )
23
- }
24
-
25
20
/// Is this set empty?
26
- pub fn is_empty ( & self ) -> bool {
21
+ pub ( crate ) fn is_empty ( & self ) -> bool {
27
22
self . items . is_empty ( )
28
23
}
29
24
30
25
/// Insert a new regex into this set.
31
- pub fn insert < S > ( & mut self , string : S )
26
+ pub ( crate ) fn insert < S > ( & mut self , string : S )
32
27
where
33
28
S : AsRef < str > ,
34
29
{
@@ -38,13 +33,13 @@ impl RegexSet {
38
33
}
39
34
40
35
/// Returns slice of String from its field 'items'
41
- pub fn get_items ( & self ) -> & [ Box < str > ] {
36
+ pub ( crate ) fn get_items ( & self ) -> & [ Box < str > ] {
42
37
& self . items
43
38
}
44
39
45
40
/// Returns an iterator over regexes in the set which didn't match any
46
41
/// strings yet.
47
- pub fn unmatched_items ( & self ) -> impl Iterator < Item = & str > {
42
+ pub ( crate ) fn unmatched_items ( & self ) -> impl Iterator < Item = & str > {
48
43
self . items . iter ( ) . enumerate ( ) . filter_map ( move |( i, item) | {
49
44
if !self . record_matches || self . matched [ i] . get ( ) {
50
45
return None ;
@@ -59,7 +54,7 @@ impl RegexSet {
59
54
/// Must be called before calling `matches()`, or it will always return
60
55
/// false.
61
56
#[ inline]
62
- pub fn build ( & mut self , record_matches : bool ) {
57
+ pub ( crate ) fn build ( & mut self , record_matches : bool ) {
63
58
self . build_inner ( record_matches, None )
64
59
}
65
60
@@ -70,7 +65,7 @@ impl RegexSet {
70
65
/// Must be called before calling `matches()`, or it will always return
71
66
/// false.
72
67
#[ inline]
73
- pub fn build_with_diagnostics (
68
+ pub ( crate ) fn build_with_diagnostics (
74
69
& mut self ,
75
70
record_matches : bool ,
76
71
name : Option < & ' static str > ,
@@ -114,7 +109,7 @@ impl RegexSet {
114
109
}
115
110
116
111
/// Does the given `string` match any of the regexes in this set?
117
- pub fn matches < S > ( & self , string : S ) -> bool
112
+ pub ( crate ) fn matches < S > ( & self , string : S ) -> bool
118
113
where
119
114
S : AsRef < str > ,
120
115
{
0 commit comments