pub struct VfsPath { /* private fields */ }
Implementations§
Source§impl Path
impl Path
Sourcepub 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
Sourcepub 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).
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true
when there are no more components left in this Path
.
Sourcepub 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 “.”.
Sourcepub 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.
Sourcepub 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.
Sourcepub 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()
.
Sourcepub 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()
.
Sourcepub 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.
Sourcepub 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().
Trait Implementations§
impl Eq for Path
Auto Trait Implementations§
impl Freeze for Path
impl RefUnwindSafe for Path
impl Send for Path
impl Sync for Path
impl Unpin for Path
impl UnwindSafe for Path
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)