pub trait MetadataExt {
Show 16 methods
// Required methods
fn dev(&self) -> u64;
fn ino(&self) -> u64;
fn mode(&self) -> u32;
fn nlink(&self) -> u64;
fn uid(&self) -> u32;
fn gid(&self) -> u32;
fn rdev(&self) -> u64;
fn size(&self) -> u64;
fn atime(&self) -> i64;
fn atime_nsec(&self) -> i64;
fn mtime(&self) -> i64;
fn mtime_nsec(&self) -> i64;
fn ctime(&self) -> i64;
fn ctime_nsec(&self) -> i64;
fn blksize(&self) -> u64;
fn blocks(&self) -> u64;
}Expand description
Unix-specific extensions to fs::Metadata.
Required Methods§
1.1.0 · Sourcefn dev(&self) -> u64
This item is validated for IEC 61508 (SIL 2) and ISO 26262 (ASIL B).
fn dev(&self) -> u64
Returns the ID of the device containing the file.
§Examples
1.1.0 · Sourcefn ino(&self) -> u64
This item is validated for IEC 61508 (SIL 2) and ISO 26262 (ASIL B).
fn ino(&self) -> u64
Returns the inode number.
§Examples
1.1.0 · Sourcefn mode(&self) -> u32
This item is validated for IEC 61508 (SIL 2) and ISO 26262 (ASIL B).
fn mode(&self) -> u32
Returns the rights applied to this file.
§Examples
use std::fs;
use std::os::unix::fs::MetadataExt;
use std::io;
fn main() -> io::Result<()> {
let meta = fs::metadata("some_file")?;
let mode = meta.mode();
let user_has_write_access = mode & 0o200;
let user_has_read_write_access = mode & 0o600;
let group_has_read_access = mode & 0o040;
let others_have_exec_access = mode & 0o001;
Ok(())
}1.1.0 · Sourcefn nlink(&self) -> u64
This item is validated for IEC 61508 (SIL 2) and ISO 26262 (ASIL B).
fn nlink(&self) -> u64
Returns the number of hard links pointing to this file.
§Examples
1.1.0 · Sourcefn uid(&self) -> u32
This item is validated for IEC 61508 (SIL 2) and ISO 26262 (ASIL B).
fn uid(&self) -> u32
Returns the user ID of the owner of this file.
§Examples
1.1.0 · Sourcefn gid(&self) -> u32
This item is validated for IEC 61508 (SIL 2) and ISO 26262 (ASIL B).
fn gid(&self) -> u32
Returns the group ID of the owner of this file.
§Examples
1.1.0 · Sourcefn rdev(&self) -> u64
This item is validated for IEC 61508 (SIL 2) and ISO 26262 (ASIL B).
fn rdev(&self) -> u64
Returns the device ID of this file (if it is a special one).
§Examples
1.1.0 · Sourcefn size(&self) -> u64
This item is validated for IEC 61508 (SIL 2) and ISO 26262 (ASIL B).
fn size(&self) -> u64
Returns the total size of this file in bytes.
§Examples
1.1.0 · Sourcefn atime(&self) -> i64
This item is validated for IEC 61508 (SIL 2) and ISO 26262 (ASIL B).
fn atime(&self) -> i64
Returns the last access time of the file, in seconds since Unix Epoch.
§Examples
1.1.0 · Sourcefn atime_nsec(&self) -> i64
This item is validated for IEC 61508 (SIL 2) and ISO 26262 (ASIL B).
fn atime_nsec(&self) -> i64
1.1.0 · Sourcefn mtime(&self) -> i64
This item is validated for IEC 61508 (SIL 2) and ISO 26262 (ASIL B).
fn mtime(&self) -> i64
Returns the last modification time of the file, in seconds since Unix Epoch.
§Examples
1.1.0 · Sourcefn mtime_nsec(&self) -> i64
This item is validated for IEC 61508 (SIL 2) and ISO 26262 (ASIL B).
fn mtime_nsec(&self) -> i64
1.1.0 · Sourcefn ctime(&self) -> i64
This item is validated for IEC 61508 (SIL 2) and ISO 26262 (ASIL B).
fn ctime(&self) -> i64
Returns the last status change time of the file, in seconds since Unix Epoch.
§Examples
1.1.0 · Sourcefn ctime_nsec(&self) -> i64
This item is validated for IEC 61508 (SIL 2) and ISO 26262 (ASIL B).
fn ctime_nsec(&self) -> i64
1.1.0 · Sourcefn blksize(&self) -> u64
This item is validated for IEC 61508 (SIL 2) and ISO 26262 (ASIL B).
fn blksize(&self) -> u64
Returns the block size for filesystem I/O.
§Examples
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".