##// END OF EJS Templates
rust: add Debug constraint to Matcher trait...
Raphaël Gomès -
r50381:e8481625 default
parent child Browse files
Show More
@@ -46,7 +46,7 b' pub enum VisitChildrenSet {'
46 Recursive,
46 Recursive,
47 }
47 }
48
48
49 pub trait Matcher {
49 pub trait Matcher: core::fmt::Debug {
50 /// Explicitly listed files
50 /// Explicitly listed files
51 fn file_set(&self) -> Option<&HashSet<HgPathBuf>>;
51 fn file_set(&self) -> Option<&HashSet<HgPathBuf>>;
52 /// Returns whether `filename` is in `file_set`
52 /// Returns whether `filename` is in `file_set`
@@ -283,6 +283,18 b" pub struct IncludeMatcher<'a> {"
283 parents: HashSet<HgPathBuf>,
283 parents: HashSet<HgPathBuf>,
284 }
284 }
285
285
286 impl core::fmt::Debug for IncludeMatcher<'_> {
287 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
288 f.debug_struct("IncludeMatcher")
289 .field("patterns", &String::from_utf8_lossy(&self.patterns))
290 .field("prefix", &self.prefix)
291 .field("roots", &self.roots)
292 .field("dirs", &self.dirs)
293 .field("parents", &self.parents)
294 .finish()
295 }
296 }
297
286 impl<'a> Matcher for IncludeMatcher<'a> {
298 impl<'a> Matcher for IncludeMatcher<'a> {
287 fn file_set(&self) -> Option<&HashSet<HgPathBuf>> {
299 fn file_set(&self) -> Option<&HashSet<HgPathBuf>> {
288 None
300 None
@@ -330,6 +342,7 b" impl<'a> Matcher for IncludeMatcher<'a> "
330 }
342 }
331
343
332 /// The union of multiple matchers. Will match if any of the matchers match.
344 /// The union of multiple matchers. Will match if any of the matchers match.
345 #[derive(Debug)]
333 pub struct UnionMatcher {
346 pub struct UnionMatcher {
334 matchers: Vec<Box<dyn Matcher + Sync>>,
347 matchers: Vec<Box<dyn Matcher + Sync>>,
335 }
348 }
@@ -393,6 +406,7 b' impl UnionMatcher {'
393 }
406 }
394 }
407 }
395
408
409 #[derive(Debug)]
396 pub struct IntersectionMatcher {
410 pub struct IntersectionMatcher {
397 m1: Box<dyn Matcher + Sync>,
411 m1: Box<dyn Matcher + Sync>,
398 m2: Box<dyn Matcher + Sync>,
412 m2: Box<dyn Matcher + Sync>,
@@ -474,6 +488,7 b' impl IntersectionMatcher {'
474 }
488 }
475 }
489 }
476
490
491 #[derive(Debug)]
477 pub struct DifferenceMatcher {
492 pub struct DifferenceMatcher {
478 base: Box<dyn Matcher + Sync>,
493 base: Box<dyn Matcher + Sync>,
479 excluded: Box<dyn Matcher + Sync>,
494 excluded: Box<dyn Matcher + Sync>,
General Comments 0
You need to be logged in to leave comments. Login now