Skip to main content

FileDetails

Struct FileDetails 

Source
pub struct FileDetails {
    pub size: u64,
    pub modified: Option<i64>,
    pub mode: Option<u32>,
    pub readonly: bool,
}
Expand description

What one entry is besides its name: its size, when it changed last, and its permissions.

A symbolic link is read as itself rather than as what it points at, the way the rows show it: a link out of the folder must not be followed for a number on screen.

Fields§

§size: u64

Its size in bytes. A folder’s own size says how big the folder itself is on disk, not what is in it; adding up a folder means reading all of it, which a manager never does by itself.

§modified: Option<i64>

When it changed last, in seconds since 1970-01-01 UTC, or None where the system does not say.

§mode: Option<u32>

The permission bits, where the platform has them (unix), and None where it does not.

§readonly: bool

Whether it may not be written, which every platform says.

Implementations§

Source§

impl FileDetails

Source

pub fn read(path: &Path) -> Option<Self>

Reads the details of the entry at path, or None when the system says nothing about it — it is gone, or may not be looked at.

This touches the disk, so it belongs on a background thread; FileManagerState asks for it with Command::perform and never while drawing.

Source

pub fn size_text(&self, folder: bool) -> String

The size in the largest unit that leaves a number worth reading: 840 B, 9.4 kB, 12 MB. A folder’s size is left out, because its own size says nothing about what is in it and a number that means nothing is worse than none.

Source

pub fn modified_text(&self) -> String

When it changed last, as the year, the month, the day and the clock the machine stands by: 2026-09-20 14:32. Empty where the system does not say.

Source

pub fn permissions_text(&self, folder: bool) -> String

Who may do what with it: the nine letters unix writes them with (rwxr-xr-x), and on a platform without them the one thing it does say, whether the entry may be written.

Trait Implementations§

Source§

impl Clone for FileDetails

Source§

fn clone(&self) -> FileDetails

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 Copy for FileDetails

Source§

impl Debug for FileDetails

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for FileDetails

Source§

impl PartialEq for FileDetails

Source§

fn eq(&self, other: &FileDetails) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for FileDetails

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> 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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> 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 = !

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.