pub struct VirtualFs { /* private fields */ }Expand description
Virtual filesystem with path translation.
Implementations§
Source§impl VirtualFs
impl VirtualFs
Sourcepub fn new(workspace_root: &Path) -> Self
pub fn new(workspace_root: &Path) -> Self
Create a new VirtualFs with default mappings for the given workspace root.
Sourcepub fn add_mapping(
&mut self,
virtual_path: impl Into<PathBuf>,
real_path: impl Into<PathBuf>,
)
pub fn add_mapping( &mut self, virtual_path: impl Into<PathBuf>, real_path: impl Into<PathBuf>, )
Add a path mapping.
Sourcepub fn translate(&self, path: &str) -> Option<PathBuf>
pub fn translate(&self, path: &str) -> Option<PathBuf>
Translate a path from child’s view to host’s view.
Returns Some(real_path) if the path matches a mapping,
None if the path should be accessed as-is (passthrough).
Sourcepub fn is_allowed(&self, path: &str) -> bool
pub fn is_allowed(&self, path: &str) -> bool
Check if a path is within any allowed scope.
In Virtualize mode, only paths within mappings or system paths are allowed.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for VirtualFs
impl RefUnwindSafe for VirtualFs
impl Send for VirtualFs
impl Sync for VirtualFs
impl Unpin for VirtualFs
impl UnsafeUnpin for VirtualFs
impl UnwindSafe for VirtualFs
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more