Skip to main content

WalkEntry

Struct WalkEntry 

Source
pub struct WalkEntry { /* private fields */ }
Expand description

One entry yielded by a Walk: a path plus the file type the directory listing reported for it.

The file type is the one from fs::DirEntry::file_type, which does not follow symlinks — a symlink is neither is_dir nor is_file, so a symlinked directory is yielded as a plain entry and never descended into. That bounds the walk: a symlink cycle cannot make it run forever (CLAUDE.md’s guard-against-unbounded- growth rule).

Implementations§

Source§

impl WalkEntry

Source

pub fn path(&self) -> &Path

The entry’s full path — the walk’s root joined with everything descended through to reach it.

Source

pub fn into_path(self) -> PathBuf

Consume the entry for its path, avoiding a clone when the path is all the caller wanted.

Source

pub fn file_name(&self) -> &OsStr

The entry’s own file name (its last path component).

Source

pub fn is_dir(&self) -> bool

Whether this entry is a directory the walk will descend into.

Source

pub fn is_file(&self) -> bool

Whether this entry is a regular file. False for symlinks — see WalkEntry’s own doc.

Source

pub fn file_type(&self) -> FileType

The unfollowed file type the directory listing reported.

Trait Implementations§

Source§

impl Debug for WalkEntry

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.