pub trait MetaDataExt {
Show 22 methods fn accessed(&self) -> Result<SystemTime, Error>; fn created(&self) -> Result<SystemTime, Error>; fn is_file(&self) -> bool; fn is_symlink(&self) -> bool; fn len(&self) -> u64; fn modified(&self) -> Result<SystemTime, Error>; 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

Utility methods to MetaData

Required Methods

Returns the last access time of this metadata.

The returned value corresponds to the atime field of stat on Unix platforms and the ftLastAccessTime field on Windows platforms.

Note that not all platforms will keep this field update in a file’s metadata, for example Windows has an option to disable updating this time when files are accessed and Linux similarly has noatime.

Returns the creation time listed in this metadata.

The returned value corresponds to the btime field of statx on Linux kernel starting from to 4.11, the birthtime field of stat on other Unix platforms, and the ftCreationTime field on Windows platforms.

Returns true if this metadata is for a regular file.

It will be false for symlink metadata obtained from symlink_metadata.

When the goal is simply to read from (or write to) the source, the most reliable way to test the source can be read (or written to) is to open it. Only using is_file can break workflows like diff <( prog_a ) on a Unix-like system for example.

Available on crate feature nightly only.

Returns true if this metadata is for a symbolic link.

Returns the size of the file, in bytes, this metadata is for.

Returns the last modification time listed in this metadata.

The returned value corresponds to the mtime field of stat on Unix platforms and the ftLastWriteTime field on Windows platforms.

Errors

This field might not be available on all platforms, and will return an Err on platforms where it is not available.

Returns the ID of the device containing the file.

Returns the inode number.

Returns the rights applied to this file.

Returns the number of hard links pointing to this file.

Returns the user ID of the owner of this file.

Returns the group ID of the owner of this file.

Returns the device ID of this file (if it is a special one).

Returns the total size of this file in bytes.

Returns the last access time of the file, in seconds since Unix Epoch.

Returns the last access time of the file, in nanoseconds since atime.

Returns the last modification time of the file, in seconds since Unix Epoch.

Returns the last modification time of the file, in nanoseconds since mtime.

Returns the last status change time of the file, in seconds since Unix Epoch.

Returns the last status change time of the file, in nanoseconds since ctime.

Returns the block size for filesystem I/O.

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.

Implementors