diff options
-rw-r--r-- | vfs/src/lib.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/vfs/src/lib.rs b/vfs/src/lib.rs index 98bd1c3..8b5df79 100644 --- a/vfs/src/lib.rs +++ b/vfs/src/lib.rs | |||
@@ -36,6 +36,11 @@ pub struct ReadOnlyVfs { | |||
36 | } | 36 | } |
37 | 37 | ||
38 | impl ReadOnlyVfs { | 38 | impl ReadOnlyVfs { |
39 | pub fn singleton<P: AsRef<Path>>(path: P, contents: &[u8]) -> Self { | ||
40 | let mut vfs = ReadOnlyVfs::default(); | ||
41 | vfs.set_file_contents(path, contents); | ||
42 | vfs | ||
43 | } | ||
39 | pub fn alloc_file_id<P: AsRef<Path>>(&mut self, path: P) -> FileId { | 44 | pub fn alloc_file_id<P: AsRef<Path>>(&mut self, path: P) -> FileId { |
40 | self.interner.intern(path.as_ref().to_owned()) | 45 | self.interner.intern(path.as_ref().to_owned()) |
41 | } | 46 | } |