mirror of
https://github.com/guilhermewerner/mini-redis
synced 2025-06-16 06:55:01 +00:00
Implement Some Tokio Tutorials
This commit is contained in:
14
Tutorial/CreateFile.rs
Normal file
14
Tutorial/CreateFile.rs
Normal file
@ -0,0 +1,14 @@
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
use tokio::fs::File;
|
||||
use tokio::io;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> io::Result<()> {
|
||||
let mut reader: &[u8] = b"hello";
|
||||
let mut file = File::create("File.txt").await?;
|
||||
|
||||
io::copy(&mut reader, &mut file).await?;
|
||||
|
||||
Ok(())
|
||||
}
|
Reference in New Issue
Block a user