doc.rust-lang.org
pub fn file_type(&self) -> FileType
Returns the file type for this metadata.
method
std
Stable since 1.1.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn created(&self) -> io::Result<SystemTime>
Returns the creation time listed in this metadata.
method
std
Stable since 1.10.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn accessed(&self) -> io::Result<SystemTime>
Returns the last access time of this metadata.
method
std
Stable since 1.10.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct Metadata
Metadata information about a file.
struct
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn is_symlink(&self) -> bool
Tests whether this file type represents a symbolic link. The result is mutually exclusive to the results of is_dir and is_file; only zero or one of these tests may pass.
method
std
Stable since 1.1.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn is_file(&self) -> bool
Tests whether this file type represents a regular file. The result is mutually exclusive to the results of is_dir and is_symlink; only zero or one of these tests may pass.
method
std
Stable since 1.1.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn is_dir(&self) -> bool
Tests whether this file type represents a directory. The result is mutually exclusive to the results of is_file and is_symlink; only zero or one of these tests may pass.
method
std
Stable since 1.1.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct FileType
A structure representing a type of file with accessors for each file type. It is returned by Metadata::file_type method.
struct
std
Stable since 1.1.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn set_modified(self, t: SystemTime) -> Self
Set the last modified time of a file.
method
std
Stable since 1.75.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn set_accessed(self, t: SystemTime) -> Self
Set the last access time of a file.
method
std
Stable since 1.75.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn new() -> Self
Creates a new FileTimes with no times set.
associated_function
std
Stable since 1.75.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct FileTimes
Representation of the various timestamps on a file.
struct
std
Stable since 1.75.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn unlock(&self) -> io::Result<()>
Release all locks on the file.
method
std
Stable since 1.89.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn try_lock_shared(&self) -> Result<(), TryLockError>
Try to acquire a shared (non-exclusive) lock on the file.
method
std
Stable since 1.89.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn try_lock(&self) -> Result<(), TryLockError>
Try to acquire an exclusive lock on the file.
method
std
Stable since 1.89.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn try_clone(&self) -> io::Result<File>
Creates a new File instance that shares the same underlying file handle as the existing File instance. Reads, writes, and seeks will affect both File instances simultaneously.
method
std
Stable since 1.9.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn sync_data(&self) -> io::Result<()>
This function is similar to sync_all, except that it might not synchronize file metadata to the filesystem.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn sync_all(&self) -> io::Result<()>
Attempts to sync all OS-internal file content and metadata to disk.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn set_times(&self, times: FileTimes) -> io::Result<()>
Changes the timestamps of the underlying file.
method
std
Stable since 1.75.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn set_permissions(&self, perm: Permissions) -> io::Result<()>
Changes the permissions on the underlying file.
method
std
Stable since 1.16.0
Version 1.100.0-nightly