pub struct VfsPath { /* private fields */ }Expand description
A sandboxed path anchored to a specific VfsRoot.
Guaranteed to prevent directory traversal (../) escapes.
Implementations§
Source§impl VfsPath
impl VfsPath
pub fn new(root: VfsRoot, subpath: impl AsRef<Path>) -> VfsPath
Sourcepub fn join(&self, path: impl AsRef<Path>) -> VfsPath
pub fn join(&self, path: impl AsRef<Path>) -> VfsPath
Appends subpath components while neutralizing directory traversal attacks.
Sourcepub fn to_uri(&self) -> String
pub fn to_uri(&self) -> String
Serializes path into a universal VFS URI string (e.g. vfs://app_data/settings.json).
Sourcepub fn has_traversal_escape(subpath: &str) -> bool
pub fn has_traversal_escape(subpath: &str) -> bool
Checks whether a given path string attempts to traverse outside of the virtual root.
Trait Implementations§
impl Eq for VfsPath
impl StructuralPartialEq for VfsPath
Auto Trait Implementations§
impl Forget for VfsPath
impl Freeze for VfsPath
impl Move for VfsPath
impl RefUnwindSafe for VfsPath
impl Send for VfsPath
impl Sync for VfsPath
impl Unpin for VfsPath
impl UnsafeUnpin for VfsPath
impl UnwindSafe for VfsPath
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.