pub struct PrefixComponent<'a> { /* private fields */ }
A structure wrapping a Windows path prefix as well as its unparsed string representation.
In addition to the parsed Prefix information returned by kind, PrefixComponent also holds the raw and unparsed OsStr slice, returned by as_os_str.
Instances of this struct can be obtained by matching against the Prefix variant on Component.
Does not occur on Unix.
use std::path::{Component, Path, Prefix};
use std::ffi::OsStr;
let path = Path::new(r"c:\you\later\");
match path.components().next().unwrap() {
Component::Prefix(prefix_component) => {
assert_eq!(Prefix::Disk(b'C'), prefix_component.kind());
assert_eq!(OsStr::new("c:"), prefix_component.as_os_str());
}
_ => unreachable!(),
}impl<'a> PrefixComponent<'a>
impl<'a> Clone for PrefixComponent<'a>
fn clone(&self) -> PrefixComponent<'a>
fn clone_from(&mut self, source: &Self)
source. Read more
impl<'a> Debug for PrefixComponent<'a>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Hash for PrefixComponent<'_>
fn hash<H: Hasher>(&self, h: &mut H)
fn hash_slice<H>(data: &[Self], state: &mut H)where
H: Hasher,
Self: Sized,impl Ord for PrefixComponent<'_>
fn cmp(&self, other: &Self) -> Ordering
fn max(self, other: Self) -> Selfwhere
Self: Sized,fn min(self, other: Self) -> Selfwhere
Self: Sized,fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized,impl<'a> PartialEq for PrefixComponent<'a>
fn eq(&self, other: &PrefixComponent<'a>) -> bool
self and other values to be equal, and is used by ==.fn ne(&self, other: &Rhs) -> bool
!=. The default implementation is almost always sufficient, and should not be overridden without very good reason.impl<'a> PartialOrd for PrefixComponent<'a>
fn partial_cmp(&self, other: &PrefixComponent<'a>) -> Option<Ordering>
fn lt(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
fn gt(&self, other: &Rhs) -> bool
fn ge(&self, other: &Rhs) -> bool
impl<'a> Copy for PrefixComponent<'a>
impl<'a> Eq for PrefixComponent<'a>
impl<'a> Freeze for PrefixComponent<'a>
impl<'a> RefUnwindSafe for PrefixComponent<'a>
impl<'a> Send for PrefixComponent<'a>
impl<'a> Sync for PrefixComponent<'a>
impl<'a> Unpin for PrefixComponent<'a>
impl<'a> UnwindSafe for PrefixComponent<'a>
impl<T> Any for Twhere
T: 'static + ?Sized,impl<T> Borrow<T> for Twhere
T: ?Sized,impl<T> BorrowMut<T> for Twhere
T: ?Sized,impl<T> CloneToUninit for Twhere
T: Clone,unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit #126799)
impl<T> From<T> for T
fn from(t: T) -> T
Returns the argument unchanged.
impl<T, U> Into<U> for Twhere
U: From<T>,fn into(self) -> U
Calls U::from(self).
That is, this conversion is whatever the implementation of From<T> for U chooses to do.
impl<T> ToOwned for Twhere
T: Clone,type Owned = T
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)
impl<T, U> TryFrom<U> for Twhere
U: Into<T>,type Error = Infallible
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto<U> for Twhere
U: TryFrom<T>,
© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/std/path/struct.PrefixComponent.html