[][src]Function tokio::fs::write

pub fn write<P, C>(
    path: P,
    contents: C
) -> impl Future<Output = Result<(), Error>> where
    C: Unpin + AsRef<[u8]>,
    P: AsRef<Path> + Send + Unpin + 'static, 

Creates a future that will open a file for writing and write the entire contents of contents to it.

This is the async equivalent of std::fs::write.

Examples

use tokio::fs;

fs::write("foo.txt", b"Hello world!").await?;