pub enum VirtualPath {
Virtual {
path: PathBuf,
virtual_prefix: PathBuf,
real_prefix: PathBuf,
},
Real(PathBuf),
}
Expand description
A container for WASI virtual paths that can also keep a reference to the original real path.
Variants§
Virtual
A virtual path with prefixes to determine a real path.
Real(PathBuf)
Only a real path. Could not be matched with a virtual prefix.
Implementations§
Source§impl VirtualPath
impl VirtualPath
Sourcepub fn exists(&self) -> bool
pub fn exists(&self) -> bool
Inherited from Path::exists
.
Sourcepub fn has_root(&self) -> bool
pub fn has_root(&self) -> bool
Inherited from Path::has_root
.
Sourcepub fn is_absolute(&self) -> bool
pub fn is_absolute(&self) -> bool
Inherited from Path::is_absolute
.
Sourcepub fn is_dir(&self) -> bool
pub fn is_dir(&self) -> bool
Inherited from Path::is_dir
.
Sourcepub fn is_file(&self) -> bool
pub fn is_file(&self) -> bool
Inherited from Path::is_file
.
Sourcepub fn is_relative(&self) -> bool
pub fn is_relative(&self) -> bool
Inherited from Path::is_relative
.
Sourcepub fn extension(&self) -> Option<&OsStr>
pub fn extension(&self) -> Option<&OsStr>
Inherited from Path::extension
.
Sourcepub fn file_name(&self) -> Option<&OsStr>
pub fn file_name(&self) -> Option<&OsStr>
Inherited from Path::file_name
.
Sourcepub fn file_stem(&self) -> Option<&OsStr>
pub fn file_stem(&self) -> Option<&OsStr>
Inherited from Path::file_stem
.
Sourcepub fn set_extension(&mut self, value: impl AsRef<OsStr>)
pub fn set_extension(&mut self, value: impl AsRef<OsStr>)
Inherited from PathBuf::set_extension
.
Sourcepub fn set_file_name(&mut self, value: impl AsRef<OsStr>)
pub fn set_file_name(&mut self, value: impl AsRef<OsStr>)
Inherited from PathBuf::set_file_name
.
Sourcepub fn starts_with(&self, value: impl AsRef<Path>) -> bool
pub fn starts_with(&self, value: impl AsRef<Path>) -> bool
Inherited from Path::starts_with
.
Sourcepub fn join<P>(&self, path: P) -> VirtualPath
pub fn join<P>(&self, path: P) -> VirtualPath
Append the path part and return a new VirtualPath
instance.
Sourcepub fn parent(&self) -> Option<VirtualPath>
pub fn parent(&self) -> Option<VirtualPath>
Return the parent directory as a new VirtualPath
instance.
Sourcepub fn any_path(&self) -> &PathBuf
pub fn any_path(&self) -> &PathBuf
Return any path available, either virtual or real, regardless of any conditions. This is primarily used for debugging.
Sourcepub fn real_path(&self) -> Option<PathBuf>
pub fn real_path(&self) -> Option<PathBuf>
Return the original real path. If we don’t have access to prefixes,
or removing prefix fails, returns None
.
Sourcepub fn real_path_string(&self) -> Option<String>
pub fn real_path_string(&self) -> Option<String>
Return the original real path as a string.
Sourcepub fn to_path_buf(&self) -> PathBuf
pub fn to_path_buf(&self) -> PathBuf
Convert the virtual path into a PathBuf
instance. This does not
convert it into a real path.
Sourcepub fn virtual_path(&self) -> Option<PathBuf>
pub fn virtual_path(&self) -> Option<PathBuf>
Return the virtual path. If a real path only, returns None
.
Sourcepub fn virtual_path_string(&self) -> Option<String>
pub fn virtual_path_string(&self) -> Option<String>
Return the virtual path as a string.
Sourcepub fn without_prefix(&self) -> Option<&Path>
pub fn without_prefix(&self) -> Option<&Path>
Return the current path without a virtual prefix.
If we don’t have access to prefixes, returns None
.
Trait Implementations§
Source§impl AsRef<OsStr> for VirtualPath
impl AsRef<OsStr> for VirtualPath
Source§impl AsRef<Path> for VirtualPath
impl AsRef<Path> for VirtualPath
Source§impl AsRef<PathBuf> for VirtualPath
impl AsRef<PathBuf> for VirtualPath
Source§impl AsRef<VirtualPath> for VirtualPath
impl AsRef<VirtualPath> for VirtualPath
Source§fn as_ref(&self) -> &VirtualPath
fn as_ref(&self) -> &VirtualPath
Source§impl Clone for VirtualPath
impl Clone for VirtualPath
Source§fn clone(&self) -> VirtualPath
fn clone(&self) -> VirtualPath
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for VirtualPath
impl Debug for VirtualPath
Source§impl Default for VirtualPath
impl Default for VirtualPath
Source§fn default() -> VirtualPath
fn default() -> VirtualPath
Source§impl<'de> Deserialize<'de> for VirtualPath
impl<'de> Deserialize<'de> for VirtualPath
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<VirtualPath, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<VirtualPath, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Display for VirtualPath
impl Display for VirtualPath
Source§impl Hash for VirtualPath
impl Hash for VirtualPath
Source§impl PartialEq for VirtualPath
impl PartialEq for VirtualPath
Source§impl Serialize for VirtualPath
impl Serialize for VirtualPath
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Eq for VirtualPath
impl StructuralPartialEq for VirtualPath
Auto Trait Implementations§
impl Freeze for VirtualPath
impl RefUnwindSafe for VirtualPath
impl Send for VirtualPath
impl Sync for VirtualPath
impl Unpin for VirtualPath
impl UnwindSafe for VirtualPath
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
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
key
and return true
if they are equal.Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string()
Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString
. Read more