fix: make example code compile (useless, but why not)
This commit is contained in:
parent
79c57f4c57
commit
bed0d6b477
1 changed files with 6 additions and 4 deletions
|
@ -29,12 +29,14 @@ mydata: 123
|
||||||
text text text `inline code` text text text
|
text text text `inline code` text text text
|
||||||
|
|
||||||
```rs
|
```rs
|
||||||
|
// cargo add tokio -F macros,rt-multi-thread,fs
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() -> std::io::Result<()> {
|
async fn main() -> std::io::Result<()> {
|
||||||
let cfg = tokio::fs::read_to_string("config.txt");
|
let cfg = tokio::fs::read_to_string("config.txt").await?;
|
||||||
let cfg: Vec<std::borrow::Cow<str>> = cfg.split(';').collect();
|
let cfg: Vec<&str> = cfg.split(';').collect();
|
||||||
println!(cfg.first().unwrap_or("hello".into()));
|
println!("{}", cfg.first().unwrap_or(&"hello"));
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue