Struct package_directory::VfsPath
pub struct VfsPath { /* private fields */ }
Implementations§
§impl Path
impl Path
pub fn dot() -> Path
pub fn dot() -> Path
Returns a path for dot, i.e. the current directory. The next
will return None for this
path.
pub fn is_dot(&self) -> bool
pub fn validate_and_split<Source>(path: Source) -> Result<Path, Status>
pub fn validate_and_split<Source>(path: Source) -> Result<Path, Status>
Splits a path
string into components, also checking if it is in a canonical form,
disallowing any “..” components, as well as empty component names. A lone “/” is translated
to “.” (the canonical form).
pub fn is_dir(&self) -> bool
pub fn is_dir(&self) -> bool
Returns true
if the canonical path contains ‘/’ as the last symbol. Note that is_dir is
false
for “.”, even though a directory is implied. The canonical form for “/” is “.”.
pub fn is_single_component(&self) -> bool
pub fn is_single_component(&self) -> bool
Returns true
when the path contains only one component - that is, it is not empty and
contains no /
characters.
pub fn next(&mut self) -> Option<&str>
pub fn next(&mut self) -> Option<&str>
Returns a reference to a portion of the string that names the next component, and move the
internal pointer to point to the next component. See also Path::peek()
.
Also see Path::next_with_ref()
if you want to use self
while holding a reference to
the returned name.
pub fn next_with_ref(&mut self) -> (&Path, Option<&str>)
pub fn next_with_ref(&mut self) -> (&Path, Option<&str>)
Rust does not allow usage of self
while the returned reference is alive, even when the
reference is actually shared. See, for example,
https://internals.rust-lang.org/t/relaxing-the-borrow-checker-for-fn-mut-self-t/3256
for additional details. So if the caller wants to call any other methods on the path
after calling next()
while still holding a reference to the returned name they can use
this method as a workaround. When Rust is extended to cover this use case, next_with_ref
should be merged into Self::next()
.
pub fn peek(&self) -> Option<&str>
pub fn peek(&self) -> Option<&str>
Returns a reference to a position of the string that names the next component, without
moving the internal pointer. So calling peek()
multiple times in a row would return the
same result. See also Self::next()
.
pub fn into_string(self) -> String
pub fn into_string(self) -> String
Converts this Path
into a String
holding the rest of the path. Note that if there are
no more components, this will return an empty string, which is not a valid path for
fuchsia.io.
pub fn with_prefix(&self, prefix: &Path) -> Path
pub fn with_prefix(&self, prefix: &Path) -> Path
Returns a path with prefix
as a prefix. This will preserve the result of is_dir().