fix: make example code compile (useless, but why not)

This commit is contained in:
DarkCat09 2024-11-21 14:34:05 +04:00
parent 79c57f4c57
commit bed0d6b477
Signed by: DarkCat09
GPG key ID: BD3CE9B65916CD82

View file

@ -29,11 +29,13 @@ 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<std::borrow::Cow<str>> = cfg.split(';').collect();
println!(cfg.first().unwrap_or("hello".into()));
let cfg = tokio::fs::read_to_string("config.txt").await?;
let cfg: Vec<&str> = cfg.split(';').collect();
println!("{}", cfg.first().unwrap_or(&"hello"));
Ok(())
}
```