Struct camino::Utf8PrefixComponent
source · #[repr(transparent)]pub struct Utf8PrefixComponent<'a>(_);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<Utf8PrefixComponent<'a>> for Utf8PrefixComponent<'a>
impl<'a> PartialEq<Utf8PrefixComponent<'a>> for Utf8PrefixComponent<'a>
source§fn eq(&self, other: &Utf8PrefixComponent<'a>) -> bool
fn eq(&self, other: &Utf8PrefixComponent<'a>) -> bool
This method tests for
self and other values to be equal, and is used
by ==.source§impl<'a> PartialOrd<Utf8PrefixComponent<'a>> for Utf8PrefixComponent<'a>
impl<'a> PartialOrd<Utf8PrefixComponent<'a>> for Utf8PrefixComponent<'a>
source§fn partial_cmp(&self, other: &Utf8PrefixComponent<'a>) -> Option<Ordering>
fn partial_cmp(&self, other: &Utf8PrefixComponent<'a>) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read moreimpl<'a> Copy for Utf8PrefixComponent<'a>
impl<'a> Eq for Utf8PrefixComponent<'a>
impl<'a> StructuralEq for Utf8PrefixComponent<'a>
impl<'a> StructuralPartialEq for Utf8PrefixComponent<'a>
Auto Trait Implementations§
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