tokio 1.48.0

An event-driven, non-blocking I/O platform for writing asynchronous I/O backed applications.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // WASI does not support all fs operations

use tempfile::tempdir;
use tokio::fs;

#[tokio::test]
async fn write() {
    let dir = tempdir().unwrap();
    let path = dir.path().join("test.txt");

    fs::write(&path, "Hello, World!").await.unwrap();

    let contents = fs::read_to_string(&path).await.unwrap();
    assert_eq!(contents, "Hello, World!");
}