comparison rust/hg-core/src/matchers.rs @ 49351:97dcd6906e6f

rust-dirstate: add support for nevermatcher This is in case this ever comes up, it's very easy to support, so might as well do it.
author Raphaël Gomès <rgomes@octobus.net>
date Wed, 08 Jun 2022 18:18:19 +0200
parents 5e53ecbc308f
children 90512ca6a255
comparison
equal deleted inserted replaced
49350:0b00998e336a 49351:97dcd6906e6f
132 fn is_exact(&self) -> bool { 132 fn is_exact(&self) -> bool {
133 false 133 false
134 } 134 }
135 } 135 }
136 136
137 /// Matches nothing.
138 #[derive(Debug)]
139 pub struct NeverMatcher;
140
141 impl Matcher for NeverMatcher {
142 fn file_set(&self) -> Option<&HashSet<HgPathBuf>> {
143 None
144 }
145 fn exact_match(&self, _filename: &HgPath) -> bool {
146 false
147 }
148 fn matches(&self, _filename: &HgPath) -> bool {
149 false
150 }
151 fn visit_children_set(&self, _directory: &HgPath) -> VisitChildrenSet {
152 VisitChildrenSet::Empty
153 }
154 fn matches_everything(&self) -> bool {
155 false
156 }
157 fn is_exact(&self) -> bool {
158 true
159 }
160 }
161
137 /// Matches the input files exactly. They are interpreted as paths, not 162 /// Matches the input files exactly. They are interpreted as paths, not
138 /// patterns. 163 /// patterns.
139 /// 164 ///
140 ///``` 165 ///```
141 /// use hg::{ matchers::{Matcher, FileMatcher}, utils::hg_path::{HgPath, HgPathBuf} }; 166 /// use hg::{ matchers::{Matcher, FileMatcher}, utils::hg_path::{HgPath, HgPathBuf} };