Skip to main content

rew_vfile/
lib.rs

1use once_cell::sync::Lazy;
2use std::sync::Mutex;
3
4pub static VIRTUAL_FILES: Lazy<Mutex<Vec<(String, String)>>> = Lazy::new(|| Mutex::new(vec![]));
5
6/// Adds a virtual file to the runtime's virtual file storage.
7///
8/// # Arguments
9/// * `path` - The path of the virtual file.
10/// * `contents` - The contents of the virtual file.
11pub fn add_virtual_file(path: &str, contents: &str) {
12  let mut files = VIRTUAL_FILES.lock().unwrap();
13  files.push((path.to_string(), contents.to_string()));
14}