Name Description Size
canonicalize.rs 1739
copy.rs 746
create_dir.rs 1560
create_dir_all.rs 1770
dir_builder.rs 3755
file
file.rs Types for working with [`File`]. [`File`]: File 25624
hard_link.rs 1322
metadata.rs 1338
mocks.rs Mock version of std::fs::File; 4180
mod.rs 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. **Warning**: These adapters may create a large number of temporary tasks, especially when reading large files. When performing a lot of operations in one batch, it may be significantly faster to use [`spawn_blocking`] directly: ``` use tokio::fs::File; use std::io::{BufReader, BufRead}; async fn count_lines(file: File) -> Result<usize, std::io::Error> { let file = file.into_std().await; tokio::task::spawn_blocking(move || { let line_count = BufReader::new(file).lines().count(); Ok(line_count) }).await? } ``` [`spawn_blocking`]: fn@crate::task::spawn_blocking [`AsyncRead`]: trait@crate::io::AsyncRead 3758
open_options
open_options.rs 23105
read.rs 1714
read_dir.rs 10991
read_link.rs 409
read_to_string.rs 916
remove_dir.rs 349
remove_dir_all.rs 431
remove_file.rs 544
rename.rs 532
set_permissions.rs 455
symlink.rs 534
symlink_dir.rs 607
symlink_file.rs 607
symlink_metadata.rs 426
try_exists.rs 1077
write.rs 881