aboutsummaryrefslogtreecommitdiff
path: root/vfs
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
parent2aec51a44015e9d466cd4bde3951e4f7e31db0cc (diff)
parallelize statix-check
Diffstat (limited to 'vfs')
-rw-r--r--vfs/Cargo.toml2
-rw-r--r--vfs/src/lib.rs8
2 files changed, 9 insertions, 1 deletions
diff --git a/vfs/Cargo.toml b/vfs/Cargo.toml
index 7a5dc6b..d1d654c 100644
--- a/vfs/Cargo.toml
+++ b/vfs/Cargo.toml
@@ -6,4 +6,4 @@ license = "MIT"
6 6
7[dependencies] 7[dependencies]
8indexmap = "1.6.2" 8indexmap = "1.6.2"
9 9rayon = "1.5.1"
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<'ρ> {