Crate tokio_fs [−] [src]
Asynchronous file and standard stream adaptation.
This module contains utility methods and adapter types for input/output to
files or standard streams (Stdin
, Stdout
, Stderr
), and
filesystem manipulation, for use within (and only within) a Tokio runtime.
Tasks run by worker threads should not block, as this could delay
servicing reactor events. Portable filesystem operations are blocking,
however. This module offers adapters which use a blocking
annotation
to inform the runtime that a blocking operation is required. When
necessary, this allows the runtime to convert the current thread from a
worker to a backup thread, where blocking is acceptable.
Usage
Where possible, users should prefer the provided asynchronous-specific
traits such as AsyncRead
, or methods returning a Future
or Poll
type. Adaptions also extend to traits like std::io::Read
where methods
return std::io::Result
. Be warned that these adapted methods may return
std::io::ErrorKind::WouldBlock
if a worker thread can not be converted
to a backup thread immediately. See tokio-threadpool for more details
of the threading model and blocking
.
Re-exports
pub use file::File; |
Modules
file |
Types for working with |
os |
OS-specific functionality. |
Structs
CreateDirAllFuture |
Future returned by |
CreateDirFuture |
Future returned by |
DirEntry |
Entries returned by the |
HardLinkFuture |
Future returned by |
MetadataFuture |
Future returned by |
OpenOptions |
Options and flags which can be used to configure how a file is opened. |
ReadDir |
Stream of the entries in a directory. |
ReadDirFuture |
Future returned by |
ReadLinkFuture |
Future returned by |
RemoveDirFuture |
Future returned by |
RemoveFileFuture |
Future returned by |
RenameFuture |
Future returned by |
SetPermissionsFuture |
Future returned by |
Stderr |
A handle to the standard error stream of a process. |
Stdin |
A handle to the standard input stream of a process. |
Stdout |
A handle to the standard output stream of a process. |
SymlinkMetadataFuture |
Future returned by |
Functions
create_dir |
Creates a new, empty directory at the provided path |
create_dir_all |
Recursively create a directory and all of its parent components if they are missing. |
hard_link |
Creates a new hard link on the filesystem. |
metadata |
Queries the file system metadata for a path. |
read_dir |
Returns a stream over the entries within a directory. |
read_link |
Reads a symbolic link, returning the file that the link points to. |
remove_dir |
Removes an existing, empty directory. |
remove_file |
Removes a file from the filesystem. |
rename |
Rename a file or directory to a new name, replacing the original file if
|
set_permissions |
Changes the permissions found on a file or a directory. |
stderr |
Constructs a new handle to the standard error of the current process. |
stdin |
Constructs a new handle to the standard input of the current process. |
stdout |
Constructs a new handle to the standard output of the current process. |
symlink_metadata |
Queries the file system metadata for a path. |