##// 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 pub enum VisitChildrenSet {
46 46 Recursive,
47 47 }
48 48
49 pub trait Matcher {
49 pub trait Matcher: core::fmt::Debug {
50 50 /// Explicitly listed files
51 51 fn file_set(&self) -> Option<&HashSet<HgPathBuf>>;
52 52 /// Returns whether `filename` is in `file_set`
@@ -283,6 +283,18 pub struct IncludeMatcher<'a> {
283 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 298 impl<'a> Matcher for IncludeMatcher<'a> {
287 299 fn file_set(&self) -> Option<&HashSet<HgPathBuf>> {
288 300 None
@@ -330,6 +342,7 impl<'a> Matcher for IncludeMatcher<'a>
330 342 }
331 343
332 344 /// The union of multiple matchers. Will match if any of the matchers match.
345 #[derive(Debug)]
333 346 pub struct UnionMatcher {
334 347 matchers: Vec<Box<dyn Matcher + Sync>>,
335 348 }
@@ -393,6 +406,7 impl UnionMatcher {
393 406 }
394 407 }
395 408
409 #[derive(Debug)]
396 410 pub struct IntersectionMatcher {
397 411 m1: Box<dyn Matcher + Sync>,
398 412 m2: Box<dyn Matcher + Sync>,
@@ -474,6 +488,7 impl IntersectionMatcher {
474 488 }
475 489 }
476 490
491 #[derive(Debug)]
477 492 pub struct DifferenceMatcher {
478 493 base: Box<dyn Matcher + Sync>,
479 494 excluded: Box<dyn Matcher + Sync>,
General Comments 0
You need to be logged in to leave comments. Login now