Show More
@@ -26,13 +26,9 b' pub trait Matcher {' | |||
|
26 | 26 | /// Explicitly listed files |
|
27 | 27 | fn file_set(&self) -> HashSet<&HgPath>; |
|
28 | 28 | /// Returns whether `filename` is in `file_set` |
|
29 |
fn exact_match(&self, |
|
|
30 | false | |
|
31 | } | |
|
29 | fn exact_match(&self, filename: impl AsRef<HgPath>) -> bool; | |
|
32 | 30 | /// Returns whether `filename` is matched by this matcher |
|
33 |
fn matches(&self, |
|
|
34 | false | |
|
35 | } | |
|
31 | fn matches(&self, filename: impl AsRef<HgPath>) -> bool; | |
|
36 | 32 | /// Decides whether a directory should be visited based on whether it |
|
37 | 33 | /// has potential matches in it or one of its subdirectories, and |
|
38 | 34 | /// potentially lists which subdirectories of that directory should be |
@@ -71,20 +67,14 b' pub trait Matcher {' | |||
|
71 | 67 | /// `VisitChildrenSet::This`). |
|
72 | 68 | fn visit_children_set( |
|
73 | 69 | &self, |
|
74 |
|
|
|
75 |
) -> VisitChildrenSet |
|
|
76 | VisitChildrenSet::This | |
|
77 | } | |
|
70 | directory: impl AsRef<HgPath>, | |
|
71 | ) -> VisitChildrenSet; | |
|
78 | 72 | /// Matcher will match everything and `files_set()` will be empty: |
|
79 | 73 | /// optimization might be possible. |
|
80 |
fn matches_everything(&self) -> bool |
|
|
81 | false | |
|
82 | } | |
|
74 | fn matches_everything(&self) -> bool; | |
|
83 | 75 | /// Matcher will match exactly the files in `files_set()`: optimization |
|
84 | 76 | /// might be possible. |
|
85 |
fn is_exact(&self) -> bool |
|
|
86 | false | |
|
87 | } | |
|
77 | fn is_exact(&self) -> bool; | |
|
88 | 78 | } |
|
89 | 79 | |
|
90 | 80 | /// Matches everything. |
@@ -95,11 +85,22 b' impl Matcher for AlwaysMatcher {' | |||
|
95 | 85 | fn file_set(&self) -> HashSet<&HgPath> { |
|
96 | 86 | HashSet::new() |
|
97 | 87 | } |
|
98 | ||
|
88 | fn exact_match(&self, _filename: impl AsRef<HgPath>) -> bool { | |
|
89 | false | |
|
90 | } | |
|
91 | fn matches(&self, _filename: impl AsRef<HgPath>) -> bool { | |
|
92 | true | |
|
93 | } | |
|
99 | 94 | fn visit_children_set( |
|
100 | 95 | &self, |
|
101 | 96 | _directory: impl AsRef<HgPath>, |
|
102 | 97 | ) -> VisitChildrenSet { |
|
103 | 98 | VisitChildrenSet::Recursive |
|
104 | 99 | } |
|
100 | fn matches_everything(&self) -> bool { | |
|
101 | true | |
|
102 | } | |
|
103 | fn is_exact(&self) -> bool { | |
|
104 | false | |
|
105 | } | |
|
105 | 106 | } |
General Comments 0
You need to be logged in to leave comments.
Login now