@@ -71,21 +71,21 @@ impl RegexBuilder {
71
71
/// Note that calling `as_str` on the resulting `Regex` will produce the
72
72
/// pattern given to `new` verbatim. Notably, it will not incorporate any
73
73
/// of the flags set on this builder.
74
- pub fn compile ( self ) -> Result <Regex , Error > {
75
- ExecBuilder :: new_options( self . 0 )
74
+ pub fn build ( & self ) -> Result <Regex , Error > {
75
+ ExecBuilder :: new_options( self . 0 . clone ( ) )
76
76
. only_utf8( $only_utf8)
77
77
. build( )
78
78
. map( Regex :: from)
79
79
}
80
80
81
81
/// Set the value for the case insensitive (`i`) flag.
82
- pub fn case_insensitive( mut self , yes: bool ) -> RegexBuilder {
82
+ pub fn case_insensitive( & mut self , yes: bool ) -> & mut RegexBuilder {
83
83
self . 0 . case_insensitive = yes;
84
84
self
85
85
}
86
86
87
87
/// Set the value for the multi-line matching (`m`) flag.
88
- pub fn multi_line( mut self , yes: bool ) -> RegexBuilder {
88
+ pub fn multi_line( & mut self , yes: bool ) -> & mut RegexBuilder {
89
89
self . 0 . multi_line = yes;
90
90
self
91
91
}
@@ -97,27 +97,27 @@ impl RegexBuilder {
97
97
/// N.B. "matches anything" means "any byte" for `regex::bytes::Regex`
98
98
/// expressions and means "any Unicode codepoint" for `regex::Regex`
99
99
/// expressions.
100
- pub fn dot_matches_new_line( mut self , yes: bool ) -> RegexBuilder {
100
+ pub fn dot_matches_new_line( & mut self , yes: bool ) -> & mut RegexBuilder {
101
101
self . 0 . dot_matches_new_line = yes;
102
102
self
103
103
}
104
104
105
105
/// Set the value for the greedy swap (`U`) flag.
106
- pub fn swap_greed( mut self , yes: bool ) -> RegexBuilder {
106
+ pub fn swap_greed( & mut self , yes: bool ) -> & mut RegexBuilder {
107
107
self . 0 . swap_greed = yes;
108
108
self
109
109
}
110
110
111
111
/// Set the value for the ignore whitespace (`x`) flag.
112
- pub fn ignore_whitespace( mut self , yes: bool ) -> RegexBuilder {
112
+ pub fn ignore_whitespace( & mut self , yes: bool ) -> & mut RegexBuilder {
113
113
self . 0 . ignore_whitespace = yes;
114
114
self
115
115
}
116
116
117
117
/// Set the value for the Unicode (`u`) flag.
118
118
///
119
119
/// For byte based regular expressions, this is disabled by default.
120
- pub fn unicode( mut self , yes: bool ) -> RegexBuilder {
120
+ pub fn unicode( & mut self , yes: bool ) -> & mut RegexBuilder {
121
121
self . 0 . unicode = yes;
122
122
self
123
123
}
@@ -127,7 +127,7 @@ impl RegexBuilder {
127
127
/// This roughly corresponds to the number of bytes occupied by a single
128
128
/// compiled program. If the program exceeds this number, then a
129
129
/// compilation error is returned.
130
- pub fn size_limit( mut self , limit: usize ) -> RegexBuilder {
130
+ pub fn size_limit( & mut self , limit: usize ) -> & mut RegexBuilder {
131
131
self . 0 . size_limit = limit;
132
132
self
133
133
}
@@ -141,7 +141,7 @@ impl RegexBuilder {
141
141
/// limit. In particular, if a regex is used from multiple threads
142
142
/// simulanteously, then each thread may use up to the number of bytes
143
143
/// specified here.
144
- pub fn dfa_size_limit( mut self , limit: usize ) -> RegexBuilder {
144
+ pub fn dfa_size_limit( & mut self , limit: usize ) -> & mut RegexBuilder {
145
145
self . 0 . dfa_size_limit = limit;
146
146
self
147
147
}
0 commit comments