Enum Stat

Source
pub enum Stat {
    Stat64(stat),
    Statx(Statx),
}
Expand description

Unified Stat structure.

Variants§

§

Stat64(stat)

§

Statx(Statx)

Implementations§

Source§

impl Stat

Source

pub const fn block_size(&self) -> i32

Returns the “preferred” block size for efficient filesystem I/O. (Writing to a file in smaller chunks may cause an inefficient read-modify-rewrite.)

Returns the number of hard links on a file.

Source

pub const fn uid(&self) -> u32

Returns the user ID of the owner of the file.

Source

pub const fn gid(&self) -> u32

Returns the ID of the group owner of the file.

Source

pub const fn mode(&self) -> Mode

Returns the file mode.

Source

pub const fn file_type(&self) -> FileType

Returns the file type.

Source

pub const fn is_socket(&self) -> bool

Returns true if file type is socket.

Returns true if file type is link.

Source

pub const fn is_regular(&self) -> bool

Returns true if file type is regular.

Source

pub const fn is_block(&self) -> bool

Returns true if file type is block.

Source

pub const fn is_directory(&self) -> bool

Returns true if file type is directory.

Source

pub const fn is_dir(&self) -> bool

Alias for Self::is_directory().

Source

pub const fn is_character(&self) -> bool

Returns true if file type is character.

Source

pub const fn is_char(&self) -> bool

Alias for Self::is_character().

Source

pub const fn is_fifo(&self) -> bool

Returns true if file type is FIFO.

Source

pub const fn inode(&self) -> u64

Returns the inode number of the file.

Source

pub const fn size(&self) -> i64

Returns the size of the file (if it is a regular file or a symbolic link) in bytes. The size of a symbolic link is the length of the pathname it contains, without a terminating null byte.

Source

pub const fn blocks(&self) -> i64

Returns the number of blocks allocated to the file on the medium, in 512-byte units. (This may be smaller than stx_size/512 when the file has holes.)

Source

pub const fn atime(&self) -> Timestamp

Returns the file’s last access timestamp.

Source

pub const fn ctime(&self) -> Timestamp

Returns the file’s last status change timestamp.

Source

pub const fn mtime(&self) -> Timestamp

Returns the file’s last modification timestamp.

Source

pub const fn rdev_major(&self) -> u32

Returns the major device that this file (inode) represents if the file is of block or character device type

Source

pub const fn rdev_minor(&self) -> u32

Returns the minor device that this file (inode) represents if the file is of block or character device type

Source

pub const fn rdev(&self) -> Dev

Returns the device that this file (inode) represents if the file is of block or character device type

Source

pub const fn dev_major(&self) -> u32

Returns the major device on which this file (inode) resides.

Source

pub const fn dev_minor(&self) -> u32

Returns the minor device on which this file (inode) resides.

Source

pub const fn dev(&self) -> Dev

Returns the device on which this file (inode) resides.

Trait Implementations§

Source§

impl Clone for Stat

Source§

fn clone(&self) -> Stat

Returns a copy of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Stat

Source§

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

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

impl Copy for Stat

Auto Trait Implementations§

§

impl Freeze for Stat

§

impl RefUnwindSafe for Stat

§

impl Send for Stat

§

impl Sync for Stat

§

impl Unpin for Stat

§

impl UnwindSafe for Stat

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> 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.