@@ -21,7 +21,7 @@ use std::ops::Index;
21
21
pub ( crate ) fn edit_list < T : Distance + Copy > (
22
22
left : impl IntoIterator < Item = T > ,
23
23
right : impl IntoIterator < Item = T > ,
24
- configuration : Configuration ,
24
+ mode : Mode ,
25
25
) -> Vec < Edit < T > > {
26
26
let left: Vec < _ > = left. into_iter ( ) . collect ( ) ;
27
27
let right: Vec < _ > = right. into_iter ( ) . collect ( ) ;
@@ -38,18 +38,18 @@ pub(crate) fn edit_list<T: Distance + Copy>(
38
38
last_edit : Edit :: ExtraLeft { left : left[ 0 ] } ,
39
39
} ) ;
40
40
41
- // The configuration changes how the beginning and the end of left is consumed.
41
+ // The mode changes how the beginning and the end of left is consumed.
42
42
// EndsWith and Contains makes the consumption of elements of left before the
43
43
// first element of right is consumed free. In the implementation, this leads
44
44
// to table[(_, 0)] == 0.
45
45
// StartsWith and Contains makes the consumption of character of left after the
46
46
// last element of right is consumed free. In the implementation, this leads to
47
47
// ExtraLeft being free when computing table[(_, right.len())].
48
- let ( free_start, free_end) = match configuration {
49
- Configuration :: FullMatch => ( false , false ) ,
50
- Configuration :: StartsWith => ( false , true ) ,
51
- Configuration :: EndsWith => ( true , false ) ,
52
- Configuration :: Contains => ( true , true ) ,
48
+ let ( free_start, free_end) = match mode {
49
+ Mode :: FullMatch => ( false , false ) ,
50
+ Mode :: StartsWith => ( false , true ) ,
51
+ Mode :: EndsWith => ( true , false ) ,
52
+ Mode :: Contains => ( true , true ) ,
53
53
} ;
54
54
55
55
for idx in 1 ..( left. len ( ) + 1 ) {
@@ -106,7 +106,7 @@ pub(crate) fn edit_list<T: Distance + Copy>(
106
106
107
107
/// Controls how `right` should match `left`.
108
108
#[ allow( dead_code) ]
109
- pub ( crate ) enum Configuration {
109
+ pub ( crate ) enum Mode {
110
110
/// `right` is fully matching `left`
111
111
FullMatch ,
112
112
/// `right` should match the beginning of `left`
@@ -157,7 +157,7 @@ impl Distance for &str {
157
157
if left == right {
158
158
return 0.0 ;
159
159
}
160
- let edits: f64 = edit_list ( left. chars ( ) , right. chars ( ) , Configuration :: FullMatch )
160
+ let edits: f64 = edit_list ( left. chars ( ) , right. chars ( ) , Mode :: FullMatch )
161
161
. into_iter ( )
162
162
. map ( |edit| match edit {
163
163
Edit :: Both { distance, .. } => distance,
@@ -211,7 +211,7 @@ mod tests {
211
211
use crate :: elements_are;
212
212
use crate :: { matcher:: Matcher , matchers:: predicate, verify_that, Result } ;
213
213
use indoc:: indoc;
214
- use Configuration :: * ;
214
+ use Mode :: * ;
215
215
216
216
fn is_both < E : PartialEq + Debug > (
217
217
l_expected : E ,
0 commit comments