https://docs.rs/tokio/1.4.0/tokio/index.html
fs | fs Asynchronous file and standard stream adaptation. |
io |
Traits, helpers, and type definitions for asynchronous I/O functionality. |
net |
TCP/UDP/Unix bindings for tokio . |
process |
process An implementation of asynchronous process management for Tokio. |
runtime |
rt The Tokio runtime. |
signal |
signal Asynchronous signal handling for Tokio |
stream |
Due to the Stream trait’s inclusion in std landing later than Tokio’s 1.0 release, most of the Tokio stream utilities have been moved into the tokio-stream crate.try_join |
sync |
sync Synchronization primitives for use in asynchronous contexts. |
tokio::task |
Asynchronous green-threads. |
tokio::time |
time Utilities for tracking time. |
| Structs |
DirBuilder |
A builder for creating directories in various manners. |
DirEntry |
Entries returned by the ReadDir stream. |
File |
A reference to an open file on the filesystem. |
OpenOptions |
Options and flags which can be used to configure how a file is opened. |
ReadDir |
Read the the entries in a directory. |
| Functions |
canonicalize |
Returns the canonical, absolute form of a path with all intermediate components normalized and symbolic links resolved. |
copy |
Copies the contents of one file to another. This function will also copy the permission bits of the original file to the destination file. This function will overwrite the contents of to. |
create_dir |
Creates a new, empty directory at the provided path |
create_dir_all |
Recursively creates a directory and all of its parent components if they are missing. |
hard_link |
Creates a new hard link on the filesystem. |
metadata |
Given a path, queries the file system to get information about a file, directory, etc. |
read |
Reads the entire contents of a file into a bytes vector. |
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. |
read_to_string |
Creates a future which will open a file for reading and read the entire contents into a string and return said string. |
remove_dir |
Removes an existing, empty directory. |
remove_dir_all |
Removes a directory at this path, after removing all its contents. Use carefully! |
remove_file |
Removes a file from the filesystem. |
rename |
Renames a file or directory to a new name, replacing the original file if to already exists. |
set_permissions |
Changes the permissions found on a file or a directory. |
symlink |
Creates a new symbolic link on the filesystem. |
symlink_metadata |
Queries the file system metadata for a path. |
write |
Creates a future that will open a file for writing and write the entire contents of contents to it. |
Re-exports |
pub use std::io::Error; |
pub use std::io::ErrorKind; |
pub use std::io::Result; |
pub use std::io::SeekFrom; |
| Modules |
unix |
net Asynchronous IO structures specific to Unix-like operating systems. |
| Structs |
BufReader |
io-util The BufReader struct adds buffering to any reader. |
BufStream |
io-util Wraps a type that is AsyncWrite and AsyncRead , and buffers its input and output. |
BufWriter |
io-util Wraps a writer and buffers its output. |
DuplexStream |
A bidirectional pipe to read and write bytes in memory. |
Empty |
io-util An async reader which is always at EOF. |
Interest |
net Readiness event interest |
Lines |
io-util Read lines from an AsyncBufRead . |
ReadBuf |
A wrapper around a byte buffer that is incrementally filled and initialized. |
ReadHalf |
io-util The readable half of a value returned from split . |
Ready |
net Describes the readiness state of an I/O resources. |
Repeat |
io-util An async reader which yields one byte over and over and over and over and over and… |
Sink |
io-util An async writer which will move data into the void. |
Split |
io-util Splitter for the split method. |
Stderr |
io-std A handle to the standard error stream of a process. |
Stdin |
io-std A handle to the standard input stream of a process. |
Stdout |
io-std A handle to the standard output stream of a process. |
Take |
io-util Stream for the take method. |
WriteHalf |
io-util The writable half of a value returned from split . |
| Functions |
copy |
io-util Asynchronously copies the entire contents of a reader into a writer. |
copy_buf |
io-util Asynchronously copies the entire contents of a reader into a writer. |
duplex |
Create a new pair of DuplexStream s that act like a pair of connected sockets. |
empty |
io-util Creates a new empty async reader. |
repeat |
io-util Creates an instance of an async reader that infinitely repeats one byte. |
sink |
io-util Creates an instance of an async writer which will successfully consume all data. |
split |
io-util Splits a single value implementing AsyncRead + AsyncWrite into separate AsyncRead and AsyncWrite handles. |
stderr |
io-std Constructs a new handle to the standard error of the current process. |
stdin |
io-std Constructs a new handle to the standard input of the current process. |
stdout |
io-std Constructs a new handle to the standard output of the current process. |
| Modules |
tcp |
net TCP utility types |
unix |
net Unix domain socket utility types |
TcpListener | net A TCP socket server, listening for connections. |
TcpSocket |
net A TCP socket that has not yet been converted to a TcpStream or TcpListener . |
TcpStream |
net A TCP stream between a local and a remote socket. |
UdpSocket |
net A UDP socket |
UnixDatagram |
net An I/O object representing a Unix datagram socket. |
UnixListener |
net A Unix socket which can accept connections from other Unix sockets. |
UnixStream |
net A structure representing a connected Unix socket. |
| Traits |
ToSocketAddrs |
Converts or resolves without blocking to one or more SocketAddr values. |
| Structs |
Child |
Representation of a child process spawned onto an event loop. |
ChildStderr |
The standard error stream for spawned children. |
ChildStdin |
The standard input stream for spawned children. |
ChildStdout |
The standard output stream for spawned children. |
Command |
This structure mimics the API of std::process::Command found in the standard library, but replaces functions that create a process with an asynchronous variant. The main provided asynchronous functions are spawn, status, and output. |
| Structs |
Builder |
Builds Tokio Runtime with custom configuration values. |
EnterGuard |
Runtime context guard. |
Handle |
Handle to the runtime. |
Runtime |
The Tokio runtime. |
| Modules |
unix |
Unix-specific types for signal handling. |
|
Functions |
ctrl_c |
Completes when a “ctrl-c” notification is sent to the process. |
tokio::sync
| Modules |
broadcast |
A multi-producer, multi-consumer broadcast queue. Each sent value is seen by all consumers. |
mpsc |
A multi-producer, single-consumer queue for sending values between asynchronous tasks. |
oneshot |
单触发通道用于在异步任务之间发送单个消息。 通道函数用于创建构成通道的“发送方”和“接收方”句柄对。 |
watch |
单生产者,多消费者通道,仅保留“最后”发送的值。 retains the last sent value. |
tokio::task
| Functions |
block_in_place |
rt-multi-thread Runs the provided blocking function on the current thread without blocking the executor. |
spawn |
rt Spawns a new asynchronous task, returning a JoinHandle for it. |
spawn_blocking |
rt Runs the provided closure on a thread where blocking is acceptable. |
spawn_local |
rt Spawns a !Send future on the local task set. |
unconstrained |
Turn off cooperative scheduling for a future. The future will never be forced to yield by Tokio. Using this exposes your service to starvation if the unconstrained future never yields otherwise. |
yield_now |
rt Yields execution back to the Tokio runtime. |
tokio::time
Duration | pub use std::time::Duration; |
|
|
|
Modules |
error |
Time error types. |
| Function |
advance |
test-util Advance time |
interval |
Creates new Interval that yields with interval of duration . The first tick completes immediately. |
interval_at |
Creates new Interval that yields with interval of period with the first tick completing at start . |
pause |
test-util Pause time |
resume |
test-util Resume time |
sleep |
Waits until duration has elapsed. |
sleep_until |
Waits until deadline is reached. |
timeout |
Require a Future to complete before the specified duration has elapsed. |
timeout_at |
Require a Future to complete before the specified instant in time. |