aboutsummaryrefslogtreecommitdiff
path: root/vfs/src
diff options
context:
space:
mode:
authorAkshay <[email protected]>2022-02-19 15:14:59 +0000
committerAkshay <[email protected]>2022-02-19 15:14:59 +0000
commita80e252193096f22ae79fa03e66a0853ddae050e (patch)
tree710796b5feb58173e7c685b432f4654e8ad84e10 /vfs/src
parent2aec51a44015e9d466cd4bde3951e4f7e31db0cc (diff)
parallelize statix-check
Diffstat (limited to 'vfs/src')
-rw-r--r--vfs/src/lib.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/vfs/src/lib.rs b/vfs/src/lib.rs
index cd6cc03..2d7577d 100644
--- a/vfs/src/lib.rs
+++ b/vfs/src/lib.rs
@@ -5,6 +5,7 @@ use std::{
5}; 5};
6 6
7use indexmap::IndexSet; 7use indexmap::IndexSet;
8use rayon::prelude::*;
8 9
9#[derive(Copy, Clone, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] 10#[derive(Copy, Clone, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)]
10pub struct FileId(pub u32); 11pub struct FileId(pub u32);
@@ -70,6 +71,13 @@ impl ReadOnlyVfs {
70 contents: self.get_str(*file_id), 71 contents: self.get_str(*file_id),
71 }) 72 })
72 } 73 }
74 pub fn par_iter(&self) -> impl ParallelIterator<Item = VfsEntry> {
75 self.data.par_iter().map(move |(file_id, _)| VfsEntry {
76 file_id: *file_id,
77 file_path: self.file_path(*file_id),
78 contents: self.get_str(*file_id),
79 })
80 }
73} 81}
74 82
75pub struct VfsEntry<'ρ> { 83pub struct VfsEntry<'ρ> {