aboutsummaryrefslogtreecommitdiff
path: root/vfs/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'vfs/src/lib.rs')
-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<'ρ> {