pub struct Utf8PrefixComponent<'a>(/* private fields */);
Expand description
A structure wrapping a Windows path prefix as well as its unparsed string representation.
In addition to the parsed Utf8Prefix
information returned by kind
,
Utf8PrefixComponent
also holds the raw and unparsed str
slice,
returned by as_str
.
Instances of this struct
can be obtained by matching against the
Prefix
variant on Utf8Component
.
Does not occur on Unix.
§Examples
use camino::{Utf8Component, Utf8Path, Utf8Prefix};
use std::ffi::OsStr;
let path = Utf8Path::new(r"c:\you\later\");
match path.components().next().unwrap() {
Utf8Component::Prefix(prefix_component) => {
assert_eq!(Utf8Prefix::Disk(b'C'), prefix_component.kind());
assert_eq!("c:", prefix_component.as_str());
}
_ => unreachable!(),
}
Implementations§
source§impl<'a> Utf8PrefixComponent<'a>
impl<'a> Utf8PrefixComponent<'a>
sourcepub fn kind(&self) -> Utf8Prefix<'a>
pub fn kind(&self) -> Utf8Prefix<'a>
Returns the parsed prefix data.
See Utf8Prefix
’s documentation for more information on the different
kinds of prefixes.
Trait Implementations§
source§impl<'a> Clone for Utf8PrefixComponent<'a>
impl<'a> Clone for Utf8PrefixComponent<'a>
source§fn clone(&self) -> Utf8PrefixComponent<'a>
fn clone(&self) -> Utf8PrefixComponent<'a>
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<'a> Debug for Utf8PrefixComponent<'a>
impl<'a> Debug for Utf8PrefixComponent<'a>
source§impl<'a> Display for Utf8PrefixComponent<'a>
impl<'a> Display for Utf8PrefixComponent<'a>
source§impl<'a> Hash for Utf8PrefixComponent<'a>
impl<'a> Hash for Utf8PrefixComponent<'a>
source§impl<'a> Ord for Utf8PrefixComponent<'a>
impl<'a> Ord for Utf8PrefixComponent<'a>
source§fn cmp(&self, other: &Utf8PrefixComponent<'a>) -> Ordering
fn cmp(&self, other: &Utf8PrefixComponent<'a>) -> 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<'a> PartialEq for Utf8PrefixComponent<'a>
impl<'a> PartialEq for Utf8PrefixComponent<'a>
source§impl<'a> PartialOrd for Utf8PrefixComponent<'a>
impl<'a> PartialOrd for Utf8PrefixComponent<'a>
impl<'a> Copy for Utf8PrefixComponent<'a>
impl<'a> Eq for Utf8PrefixComponent<'a>
impl<'a> StructuralPartialEq for Utf8PrefixComponent<'a>
Auto Trait Implementations§
impl<'a> Freeze for Utf8PrefixComponent<'a>
impl<'a> RefUnwindSafe for Utf8PrefixComponent<'a>
impl<'a> Send for Utf8PrefixComponent<'a>
impl<'a> Sync for Utf8PrefixComponent<'a>
impl<'a> Unpin for Utf8PrefixComponent<'a>
impl<'a> UnwindSafe for Utf8PrefixComponent<'a>
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
)