pub trait MetadataExt { 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; }
Unix-specific extensions to fs::Metadata
.
fn dev(&self) -> u64
Returns the ID of the device containing the file.
fn ino(&self) -> u64
Returns the inode number.
fn mode(&self) -> u32
Returns the rights applied to this file.
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(()) }
fn nlink(&self) -> u64
Returns the number of hard links pointing to this file.
fn uid(&self) -> u32
Returns the user ID of the owner of this file.
fn gid(&self) -> u32
Returns the group ID of the owner of this file.
fn rdev(&self) -> u64
Returns the device ID of this file (if it is a special one).
fn size(&self) -> u64
Returns the total size of this file in bytes.
fn atime(&self) -> i64
Returns the last access time of the file, in seconds since Unix Epoch.
fn atime_nsec(&self) -> i64
Returns the last access time of the file, in nanoseconds since atime
.
fn mtime(&self) -> i64
Returns the last modification time of the file, in seconds since Unix Epoch.
fn mtime_nsec(&self) -> i64
Returns the last modification time of the file, in nanoseconds since mtime
.
fn ctime(&self) -> i64
Returns the last status change time of the file, in seconds since Unix Epoch.
fn ctime_nsec(&self) -> i64
Returns the last status change time of the file, in nanoseconds since ctime
.
fn blksize(&self) -> u64
Returns the block size for filesystem I/O.
fn blocks(&self) -> u64
Returns the number of blocks allocated to the file, in 512-byte units.
Please note that this may be smaller than st_size / 512
when the file has holes.
impl MetadataExt for Metadata
[src]
fn dev(&self) -> u64
[src]
fn ino(&self) -> u64
[src]
fn mode(&self) -> u32
[src]
fn nlink(&self) -> u64
[src]
fn uid(&self) -> u32
[src]
fn gid(&self) -> u32
[src]
fn rdev(&self) -> u64
[src]
fn size(&self) -> u64
[src]
fn atime(&self) -> i64
[src]
fn atime_nsec(&self) -> i64
[src]
fn mtime(&self) -> i64
[src]
fn mtime_nsec(&self) -> i64
[src]
fn ctime(&self) -> i64
[src]
fn ctime_nsec(&self) -> i64
[src]
fn blksize(&self) -> u64
[src]
fn blocks(&self) -> u64
[src]
© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/std/os/unix/fs/trait.MetadataExt.html