Struct Statx

Source
#[repr(C)]
pub struct Statx { /* private fields */ }
Expand description

statx() file informations representation.

Implementations§

Source§

impl Statx

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

Source

pub const fn attributes(&self) -> u64

Returns further status information about the file (see below for more information).

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 attributes_mask(&self) -> StatXAttr

A mask indicating which bits in stx_attributes are supported by the VFS and the filesystem.

Source

pub const fn atime(&self) -> Timestamp

Returns the file’s last access timestamp.

Source

pub const fn btime(&self) -> Timestamp

Returns the file’s creation 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.

Source

pub const fn mount_id(&self) -> u64

The mount ID of the mount containing the file. This is the same number reported by name_to_handle_at(2) and corresponds to the number in the first field in one of the records in /proc/self/mountinfo.

Source

pub const fn dio_mem_align(&self) -> u32

Returns the alignment (in bytes) required for user memory buffers for direct I/O (O_DIRECT) on this file, or 0 if direct I/O is not supported on this file.

STATX_DIOALIGN (stx_dio_mem_align and stx_dio_offset_align) is supported on block devices since Linux 6.1. The support on regular files varies by filesystem; it is supported by ext4, f2fs, and xfs since Linux 6.1.

Source

pub const fn dio_offset_align(&self) -> u32

Returns the alignment (in bytes) required for file offsets and I/O segment lengths for direct I/O (O_DIRECT) on this file, or 0 if direct I/O is not supported on this file. This will only be nonzero if stx_dio_mem_align is nonzero, and vice versa.

Trait Implementations§

Source§

impl Clone for Statx

Source§

fn clone(&self) -> Statx

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 Statx

Source§

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

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

impl Copy for Statx

Auto Trait Implementations§

§

impl Freeze for Statx

§

impl RefUnwindSafe for Statx

§

impl Send for Statx

§

impl Sync for Statx

§

impl Unpin for Statx

§

impl UnwindSafe for Statx

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.