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
sourceimpl<'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
sourceimpl<'a> Clone for Utf8PrefixComponent<'a>
impl<'a> Clone for Utf8PrefixComponent<'a>
sourcefn clone(&self) -> Utf8PrefixComponent<'a>
fn clone(&self) -> Utf8PrefixComponent<'a>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl<'a> Debug for Utf8PrefixComponent<'a>
impl<'a> Debug for Utf8PrefixComponent<'a>
sourceimpl<'a> Display for Utf8PrefixComponent<'a>
impl<'a> Display for Utf8PrefixComponent<'a>
sourceimpl<'a> Hash for Utf8PrefixComponent<'a>
impl<'a> Hash for Utf8PrefixComponent<'a>
sourceimpl<'a> Ord for Utf8PrefixComponent<'a>
impl<'a> Ord for Utf8PrefixComponent<'a>
sourcefn cmp(&self, other: &Utf8PrefixComponent<'a>) -> Ordering
fn cmp(&self, other: &Utf8PrefixComponent<'a>) -> Ordering
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl<'a> PartialEq<Utf8PrefixComponent<'a>> for Utf8PrefixComponent<'a>
impl<'a> PartialEq<Utf8PrefixComponent<'a>> for Utf8PrefixComponent<'a>
sourcefn 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 ==. Read more
sourcefn ne(&self, other: &Utf8PrefixComponent<'a>) -> bool
fn ne(&self, other: &Utf8PrefixComponent<'a>) -> bool
This method tests for !=.
sourceimpl<'a> PartialOrd<Utf8PrefixComponent<'a>> for Utf8PrefixComponent<'a>
impl<'a> PartialOrd<Utf8PrefixComponent<'a>> for Utf8PrefixComponent<'a>
sourcefn partial_cmp(&self, other: &Utf8PrefixComponent<'a>) -> Option<Ordering>
fn partial_cmp(&self, other: &Utf8PrefixComponent<'a>) -> Option<Ordering>
This method returns an ordering between self and other values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · sourcefn 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 more
impl<'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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more