Struct DirEntry

pub struct DirEntry { /* private fields */ }

A directory entry with a possible error attached.

The error typically refers to a problem parsing ignore files in a particular directory.

Implementations

impl DirEntry

fn path(&self) -> &Path

The full path that this entry represents.

fn into_path(self) -> PathBuf

The full path that this entry represents. Analogous to DirEntry::path, but moves ownership of the path.

Whether this entry corresponds to a symbolic link or not.

fn is_stdin(&self) -> bool

Returns true if and only if this entry corresponds to stdin.

i.e., The entry has depth 0 and its file name is -.

fn metadata(&self) -> Result<Metadata, Error>

Return the metadata for the file that this entry points to.

fn file_type(&self) -> Option<FileType>

Return the file type for the file that this entry points to.

This entry doesn't have a file type if it corresponds to stdin.

fn file_name(&self) -> &OsStr

Return the file name of this entry.

If this entry has no file name (e.g., /), then the full path is returned.

fn depth(&self) -> usize

Returns the depth at which this entry was created relative to the root.

fn ino(&self) -> Option<u64>

Returns the underlying inode number if one exists.

If this entry doesn't have an inode number, then None is returned.

fn error(&self) -> Option<&Error>

Returns an error, if one exists, associated with processing this entry.

An example of an error is one that occurred while parsing an ignore file. Errors related to traversing a directory tree itself are reported as part of yielding the directory entry, and not with this method.

Trait Implementations

impl Clone for DirEntry

fn clone(&self) -> DirEntry

impl Debug for DirEntry

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

Auto Trait Implementations

impl !RefUnwindSafe for DirEntry

impl !UnwindSafe for DirEntry

impl Freeze for DirEntry

impl Send for DirEntry

impl Sync for DirEntry

impl Unpin for DirEntry

impl UnsafeUnpin for DirEntry

Blanket Implementations

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

fn type_id(&self) -> TypeId

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

fn borrow(&self) -> &T

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

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

impl<T> CloneToUninit for DirEntry where T: Clone,

unsafe fn clone_to_uninit(&self, dest: *mut u8)

impl<T> From<T> for DirEntry

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Pointable for DirEntry

const ALIGN: usize = _;
type Init = T;
unsafe fn init(init: <T as Pointable>::Init) -> usize
unsafe fn deref<'a>(ptr: usize) -> &'a T
unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
unsafe fn drop(ptr: usize)

impl<T> ToOwned for DirEntry where T: Clone,

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

impl<T, U> Into<U> for DirEntry where 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, U> TryFrom<U> for DirEntry where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

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

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