mirror of
https://github.com/KaiserY/trpl-zh-cn
synced 2025-05-04 12:38:07 +08:00
13 lines
255 B
Rust
Executable File
13 lines
255 B
Rust
Executable File
// ANCHOR: here
|
|
use std::fs;
|
|
use std::io;
|
|
|
|
fn read_username_from_file() -> Result<String, io::Error> {
|
|
fs::read_to_string("hello.txt")
|
|
}
|
|
// ANCHOR_END: here
|
|
|
|
fn main() {
|
|
let username = read_username_from_file().expect("Unable to get username");
|
|
}
|