Struct Components
#[must_use = "iterators are lazy and do nothing unless consumed"]
pub struct Components<'a> { pub(in ::path) path: &'a [u8], pub(in ::path) prefix: Option<Prefix<'a>>, pub(in ::path) has_physical_root: bool, pub(in ::path) front: State, pub(in ::path) back: State }
An iterator over the Components of a Path.
This struct is created by the components method on Path.
See its documentation for more.
Examples
use Path;
let path = new;
for component in path.components
Fields
path: &'a [u8]prefix: Option<Prefix<'a>>has_physical_root: boolfront: Stateback: State
Implementations
impl<'a> Components<'a>
fn prefix_len(&self) -> usizefn prefix_verbatim(&self) -> boolfn prefix_remaining(&self) -> usizehow much of the prefix is left from the point of view of iteration?
fn len_before_body(&self) -> usizefn finished(&self) -> boolfn is_sep_byte(&self, b: u8) -> boolfn as_path(&self) -> &'a PathExtracts a slice corresponding to the portion of the path remaining for iteration.
Examples
use Path; let mut components = new.components; components.next; components.next; assert_eq!;fn has_root(&self) -> boolIs the original path rooted?
fn include_cur_dir(&self) -> boolShould the normalized path include a leading . ?
unsafe fn parse_single_component<'b>(&self, comp: &'b [u8]) -> Option<Component<'b>>fn parse_next_component(&self) -> (usize, Option<Component<'a>>)fn parse_next_component_back(&self) -> (usize, Option<Component<'a>>)fn trim_left(&mut self)fn trim_right(&mut self)
Trait Implementations
impl AsRef<OsStr> for Components<'_>
fn as_ref(&self) -> &OsStr
impl AsRef<Path> for Components<'_>
fn as_ref(&self) -> &Path
impl Debug for Components<'_>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Eq for Components<'_>
impl FusedIterator for Components<'_>
impl Ord for Components<'_>
fn cmp(&self, other: &Self) -> Ordering
impl<'a> Clone for Components<'a>
fn clone(&self) -> Components<'a>
impl<'a> DoubleEndedIterator for Components<'a>
fn next_back(&mut self) -> Option<Component<'a>>
impl<'a> Iterator for Components<'a>
type Item = Component<'a>;fn next(&mut self) -> Option<Component<'a>>
impl<'a> PartialEq for Components<'a>
fn eq(&self, other: &Components<'a>) -> bool
impl<'a> PartialOrd for Components<'a>
fn partial_cmp(&self, other: &Components<'a>) -> Option<Ordering>
Auto Trait Implementations
impl<'a> Freeze for Components<'a>
impl<'a> RefUnwindSafe for Components<'a>
impl<'a> Send for Components<'a>
impl<'a> Sync for Components<'a>
impl<'a> Unpin for Components<'a>
impl<'a> UnsafeUnpin for Components<'a>
impl<'a> UnwindSafe for Components<'a>
Blanket Implementations
impl<I> IntoIterator for Components<'a>
where
I: Iterator,
type Item = <I as Iterator>::Item;type IntoIter = I;fn into_iter(self) -> I
impl<T> Any for Components<'a>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Components<'a>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Components<'a>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for Components<'a>
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for Components<'a>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> SizeHint for Components<'a>
where
T: ?Sized,
fn lower_bound(&self) -> usizefn upper_bound(&self) -> Option<usize>
impl<T> SizedTypeProperties for Components<'a>
impl<T> ToOwned for Components<'a>
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T, U> Into<U> for Components<'a>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Components<'a>
where
U: Into<T>,
type Error = Infallible;fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto<U> for Components<'a>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>