Skip to main content

Entry

Struct Entry 

Source
pub struct Entry {
Show 23 fields pub path: PathBuf, pub name: String, pub kind: EntryKind, pub size: u64, pub modified: Option<SystemTime>, pub created: Option<SystemTime>, pub accessed: Option<SystemTime>, pub changed: Option<SystemTime>, pub mode: u32, pub readonly: bool, pub symlink_target: Option<PathBuf>, pub depth: usize, pub git_status: GitStatus, pub is_dir_header: bool, pub nlink: u64, pub uid: u32, pub gid: u32, pub inode: u64, pub blocks: u64, pub owner: String, pub group: String, pub author: String, pub context: String,
}
Expand description

A single filesystem entry ready for formatting.

Fields§

§path: PathBuf§name: String§kind: EntryKind§size: u64§modified: Option<SystemTime>§created: Option<SystemTime>§accessed: Option<SystemTime>§changed: Option<SystemTime>

Status-change time (st_ctime) when available.

§mode: u32

Permission mode bits (unix) or 0 on platforms without them.

§readonly: bool§symlink_target: Option<PathBuf>§depth: usize§git_status: GitStatus§is_dir_header: bool

True when this entry is a directory listing header (for recursive mode).

§nlink: u64

Hard link count (st_nlink).

§uid: u32§gid: u32§inode: u64§blocks: u64

Allocated blocks in 512-byte units (GNU ls -s style) when known.

§owner: String

Owner name (or numeric string).

§group: String

Group name (or numeric string).

§author: String

Author (GNU --author); typically same as owner on Linux.

§context: String

SELinux security context (-Z); empty if unavailable.

Implementations§

Source§

impl Entry

Source

pub fn from_path(path: impl AsRef<Path>, depth: usize) -> Result<Self>

Source

pub fn from_path_with( path: impl AsRef<Path>, depth: usize, fill: MetaFill, ) -> Result<Self>

Source

pub fn from_path_follow(path: impl AsRef<Path>, depth: usize) -> Result<Self>

Like [from_path] but follow the final symlink target for metadata (-L).

Source

pub fn from_path_follow_with( path: impl AsRef<Path>, depth: usize, fill: MetaFill, ) -> Result<Self>

Source

pub fn from_path_and_meta( path: &Path, meta: &Metadata, depth: usize, ) -> Result<Self>

Source

pub fn from_path_and_meta_with( path: &Path, meta: &Metadata, depth: usize, fill: MetaFill, ) -> Result<Self>

Source

pub fn dir_header(path: impl AsRef<Path>, depth: usize) -> Self

Create a synthetic directory header for recursive listings.

Source

pub fn is_hidden(&self) -> bool

Source

pub fn is_dir(&self) -> bool

Source

pub fn modified_datetime(&self) -> Option<DateTime<Local>>

Source

pub fn accessed_datetime(&self) -> Option<DateTime<Local>>

Source

pub fn created_datetime(&self) -> Option<DateTime<Local>>

Source

pub fn changed_datetime(&self) -> Option<DateTime<Local>>

Source

pub fn time_for(&self, field: TimeField) -> Option<SystemTime>

Source

pub fn datetime_for(&self, field: TimeField) -> Option<DateTime<Local>>

Source

pub fn extension(&self) -> Option<&str>

Source

pub fn owner_display(&self, numeric: bool) -> String

Owner string for display (-n forces numeric).

Source

pub fn group_display(&self, numeric: bool) -> String

Source

pub fn author_display(&self, numeric: bool) -> String

Trait Implementations§

Source§

impl Clone for Entry

Source§

fn clone(&self) -> Entry

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Entry

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Entry

§

impl RefUnwindSafe for Entry

§

impl Send for Entry

§

impl Sync for Entry

§

impl Unpin for Entry

§

impl UnsafeUnpin for Entry

§

impl UnwindSafe for Entry

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> CloneToUninit for T
where T: Clone,

Source§

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

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.