pub struct NamespacePath(/* private fields */);
Expand description
NamespacePath is the same as Path but accepts "/"
(which is also a valid namespace
path).
Note that while "/"
is accepted, "."
(which is synonymous in fuchsia.io) is rejected.
Implementations§
Source§impl NamespacePath
impl NamespacePath
Sourcepub fn new(path: impl AsRef<str>) -> Result<Self, ParseError>
pub fn new(path: impl AsRef<str>) -> Result<Self, ParseError>
Like Path::new but path
may be /
.
Sourcepub fn root() -> Self
pub fn root() -> Self
Returns the NamespacePath for "/"
.
pub fn is_root(&self) -> bool
pub fn to_path_buf(&self) -> PathBuf
Sourcepub fn parent(&self) -> Option<Self>
pub fn parent(&self) -> Option<Self>
Returns a path that represents the parent directory of this one, or None if this is a root dir.
Sourcepub fn has_prefix(&self, prefix: &Self) -> bool
pub fn has_prefix(&self, prefix: &Self) -> bool
Returns whether prefix
is a prefix of self
in terms of path segments.
For example:
Path("/pkg/data").has_prefix("/pkg") == true
Path("/pkg_data").has_prefix("/pkg") == false
pub fn pop_front(&mut self) -> Option<Name>
Trait Implementations§
Source§impl Clone for NamespacePath
impl Clone for NamespacePath
Source§fn clone(&self) -> NamespacePath
fn clone(&self) -> NamespacePath
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for NamespacePath
impl Debug for NamespacePath
Source§impl Display for NamespacePath
impl Display for NamespacePath
Source§impl From<NamespacePath> for CString
impl From<NamespacePath> for CString
Source§fn from(path: NamespacePath) -> Self
fn from(path: NamespacePath) -> Self
Converts to this type from the input type.
Source§impl From<NamespacePath> for String
impl From<NamespacePath> for String
Source§fn from(path: NamespacePath) -> Self
fn from(path: NamespacePath) -> Self
Converts to this type from the input type.
Source§impl From<Path> for NamespacePath
impl From<Path> for NamespacePath
Source§impl FromStr for NamespacePath
impl FromStr for NamespacePath
Source§impl Hash for NamespacePath
impl Hash for NamespacePath
Source§impl IterablePath for NamespacePath
impl IterablePath for NamespacePath
Source§fn iter_segments(&self) -> impl DoubleEndedIterator<Item = &Name> + Send
fn iter_segments(&self) -> impl DoubleEndedIterator<Item = &Name> + Send
Returns a double-sided iterator over the segments in this path.
Source§impl Ord for NamespacePath
impl Ord for NamespacePath
Source§fn cmp(&self, other: &NamespacePath) -> Ordering
fn cmp(&self, other: &NamespacePath) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for NamespacePath
impl PartialEq for NamespacePath
Source§impl PartialOrd for NamespacePath
impl PartialOrd for NamespacePath
Source§impl Serialize for NamespacePath
impl Serialize for NamespacePath
Source§impl TryFrom<CString> for NamespacePath
impl TryFrom<CString> for NamespacePath
Source§type Error = ParseError
type Error = ParseError
The type returned in the event of a conversion error.
impl Eq for NamespacePath
impl StructuralPartialEq for NamespacePath
Auto Trait Implementations§
impl Freeze for NamespacePath
impl RefUnwindSafe for NamespacePath
impl Send for NamespacePath
impl Sync for NamespacePath
impl Unpin for NamespacePath
impl UnwindSafe for NamespacePath
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)