From bed0d6b477c6df9a0a482177f3e50dc5e72b48da Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Thu, 21 Nov 2024 14:34:05 +0400 Subject: [PATCH] fix: make example code compile (useless, but why not) --- source/test.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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(()) } ```