diff --git a/source/test.md b/source/test.md index eeb57cb..5bdf4a5 100644 --- a/source/test.md +++ b/source/test.md @@ -29,12 +29,14 @@ mydata: 123 text text text `inline code` text text text ```rs +// cargo add tokio -F macros,rt-multi-thread,fs + #[tokio::main] async fn main() -> std::io::Result<()> { - let cfg = tokio::fs::read_to_string("config.txt"); - let cfg: Vec> = cfg.split(';').collect(); - println!(cfg.first().unwrap_or("hello".into())); - Ok(()) + let cfg = tokio::fs::read_to_string("config.txt").await?; + let cfg: Vec<&str> = cfg.split(';').collect(); + println!("{}", cfg.first().unwrap_or(&"hello")); + Ok(()) } ```