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 duplicate 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 Utf8PrefixComponent<'_>
impl Debug for Utf8PrefixComponent<'_>
Source§impl Display for Utf8PrefixComponent<'_>
impl Display for Utf8PrefixComponent<'_>
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