aboutsummaryrefslogtreecommitdiff
path: root/crates/vfs/src/loader.rs
diff options
context:
space:
mode:
authorArnaud <[email protected]>2021-01-12 16:41:45 +0000
committerArnaud <[email protected]>2021-01-12 17:01:47 +0000
commit4b71c8332daf9ef461891d278f2cf3530baaa833 (patch)
tree1a0d16083438c999539c2c9e8a643e449e40fa53 /crates/vfs/src/loader.rs
parent311ec70d03c27b1b37457ef44510e735fcce0885 (diff)
Document vfs private items
Diffstat (limited to 'crates/vfs/src/loader.rs')
-rw-r--r--crates/vfs/src/loader.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/crates/vfs/src/loader.rs b/crates/vfs/src/loader.rs
index 399015043..d3bdae562 100644
--- a/crates/vfs/src/loader.rs
+++ b/crates/vfs/src/loader.rs
@@ -147,6 +147,13 @@ impl Directories {
147 pub fn contains_dir(&self, path: &AbsPath) -> bool { 147 pub fn contains_dir(&self, path: &AbsPath) -> bool {
148 self.includes_path(path) 148 self.includes_path(path)
149 } 149 }
150
151 /// Returns `true` if `path` is included in `self`.
152 ///
153 /// It is included if
154 /// - An element in `self.include` is a prefix of `path`.
155 /// - This path is longer than any element in `self.exclude` that is a prefix
156 /// of `path`. In case of equality, exclusion wins.
150 fn includes_path(&self, path: &AbsPath) -> bool { 157 fn includes_path(&self, path: &AbsPath) -> bool {
151 let mut include: Option<&AbsPathBuf> = None; 158 let mut include: Option<&AbsPathBuf> = None;
152 for incl in &self.include { 159 for incl in &self.include {
@@ -170,6 +177,14 @@ impl Directories {
170 } 177 }
171} 178}
172 179
180/// Returns :
181/// ```text
182/// Directories {
183/// extensions: ["rs"],
184/// include: [base],
185/// exclude: [base/<exclude>],
186/// }
187/// ```
173fn dirs(base: AbsPathBuf, exclude: &[&str]) -> Directories { 188fn dirs(base: AbsPathBuf, exclude: &[&str]) -> Directories {
174 let exclude = exclude.iter().map(|it| base.join(it)).collect::<Vec<_>>(); 189 let exclude = exclude.iter().map(|it| base.join(it)).collect::<Vec<_>>();
175 Directories { extensions: vec!["rs".to_string()], include: vec![base], exclude } 190 Directories { extensions: vec!["rs".to_string()], include: vec![base], exclude }