doc.rust-lang.org
pub fn set_modified(&self, time: SystemTime) -> io::Result<()>
Changes the modification time of the underlying file.
method
std
Stable since 1.75.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn set_len(&self, size: u64) -> io::Result<()>
Truncates or extends the underlying file, updating the size of this file to become size.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn options() -> OpenOptions
Returns a new OpenOptions object.
associated_function
std
Stable since 1.58.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn open<P>(path: P) -> io::Result<File>
Attempts to open a file in read-only mode.
associated_function
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn metadata(&self) -> io::Result<Metadata>
Queries metadata about the underlying file.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn lock_shared(&self) -> io::Result<()>
Acquire a shared (non-exclusive) lock on the file. Blocks until the lock can be acquired.
method
std
Stable since 1.89.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn lock(&self) -> io::Result<()>
Acquire an exclusive lock on the file. Blocks until the lock can be acquired.
method
std
Stable since 1.89.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn create_new<P>(path: P) -> io::Result<File>
Creates a new file in read-write mode; error if the file exists.
associated_function
std
Stable since 1.77.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn create<P>(path: P) -> io::Result<File>
Opens a file in write-only mode.
associated_function
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct File
An object providing access to an open file on the filesystem.
struct
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn path(&self) -> PathBuf
Returns the full path to the file that this entry represents.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn metadata(&self) -> io::Result<Metadata>
Returns the metadata for the file that this entry points at.
method
std
Stable since 1.1.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn file_type(&self) -> io::Result<FileType>
Returns the file type for the file that this entry points at.
method
std
Stable since 1.1.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn file_name(&self) -> OsString
Returns the file name of this directory entry without any leading path component(s).
method
std
Stable since 1.1.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct DirEntry
Entries returned by the ReadDir iterator.
struct
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn recursive(&mut self, recursive: bool) -> &mut Self
Indicates that directories should be created recursively, creating all parent directories. Parents that do not exist are created with the same security and permissions settings.
method
std
Stable since 1.6.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn new() -> DirBuilder
Creates a new set of options with default mode/security settings for all platforms and also non-recursive.
associated_function
std
Stable since 1.6.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn create<P>(&self, path: P) -> io::Result<()>
Creates the specified directory with the options configured in this builder.
method
std
Stable since 1.6.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct DirBuilder
A builder used to create directories in various manners.
struct
std
Stable since 1.6.0
Version 1.100.0-nightly
doc.rust-lang.org
pub mod fs
Filesystem manipulation operations.
module
std
Stable since 1.0.0
Version 1.100.0-nightly