comparison rust/hg-core/src/matchers.rs @ 43834:542c8b277261

rust-matchers: add doctests for `AlwaysMatcher` Differential Revision: https://phab.mercurial-scm.org/D7527
author Raphaël Gomès <rgomes@octobus.net>
date Fri, 29 Nov 2019 18:53:52 +0100
parents 1bb4e9b02984
children bc7d8f45c3b6
comparison
equal deleted inserted replaced
43833:4f1543a2f5c3 43834:542c8b277261
76 /// might be possible. 76 /// might be possible.
77 fn is_exact(&self) -> bool; 77 fn is_exact(&self) -> bool;
78 } 78 }
79 79
80 /// Matches everything. 80 /// Matches everything.
81 ///```
82 /// use hg::{ matchers::{Matcher, AlwaysMatcher}, utils::hg_path::HgPath };
83 ///
84 /// let matcher = AlwaysMatcher;
85 ///
86 /// assert_eq!(true, matcher.matches(HgPath::new(b"whatever")));
87 /// assert_eq!(true, matcher.matches(HgPath::new(b"b.txt")));
88 /// assert_eq!(true, matcher.matches(HgPath::new(b"main.c")));
89 /// assert_eq!(true, matcher.matches(HgPath::new(br"re:.*\.c$")));
90 /// ```
81 #[derive(Debug)] 91 #[derive(Debug)]
82 pub struct AlwaysMatcher; 92 pub struct AlwaysMatcher;
83 93
84 impl Matcher for AlwaysMatcher { 94 impl Matcher for AlwaysMatcher {
85 fn file_set(&self) -> Option<&HashSet<&HgPath>> { 95 fn file_set(&self) -> Option<&HashSet<&HgPath>> {