pub trait Stat {
Show 16 methods
// Required methods
fn dev(&self) -> u64;
fn ino(&self) -> u64;
fn mode(&self) -> Mode;
fn type(&self) -> FileType;
fn nlink(&self) -> u64;
fn uid(&self) -> Uid;
fn gid(&self) -> Gid;
fn size(&self) -> u64;
// Provided methods
fn identity(&self) -> (u64, u64) { ... }
fn is_regular_file(&self) -> bool { ... }
fn is_directory(&self) -> bool { ... }
fn is_symlink(&self) -> bool { ... }
fn is_fifo(&self) -> bool { ... }
fn is_block_device(&self) -> bool { ... }
fn is_character_device(&self) -> bool { ... }
fn is_socket(&self) -> bool { ... }
}Expand description
Metadata of a file
Implementations of this trait represent metadata of a file, such as its
type, permissions, owner, size, etc. The Fstat trait provides methods to
retrieve Stat objects for files.
Required Methods§
Sourcefn mode(&self) -> Mode
fn mode(&self) -> Mode
File mode (permission bits)
Note that this field does not include the file type bits.
Use type to get the file type.
You can also use is_regular_file and other
similar methods to check the file type.
Provided Methods§
Sourcefn identity(&self) -> (u64, u64)
fn identity(&self) -> (u64, u64)
Returns the device ID and inode number as a tuple.
This method is useful for testing whether two Stat objects refer to
the same file.
Sourcefn is_regular_file(&self) -> bool
fn is_regular_file(&self) -> bool
Whether the file is a regular file
Sourcefn is_directory(&self) -> bool
fn is_directory(&self) -> bool
Whether the file is a directory
Sourcefn is_symlink(&self) -> bool
fn is_symlink(&self) -> bool
Whether the file is a symbolic link
Sourcefn is_block_device(&self) -> bool
fn is_block_device(&self) -> bool
Whether the file is a block device
Sourcefn is_character_device(&self) -> bool
fn is_character_device(&self) -> bool
Whether the file is a character device