Rust14 linesUpdated Jul 17, 2026
Rust
use std::fs;
use std::io;
fn read_config(path: &str) -> io::Result<String> {
let contents = fs::read_to_string(path)?;
Ok(contents)
}
fn main() {
match read_config("config.toml") {
Ok(text) => println!("{text}"),
Err(e) => eprintln!("error: {e}"),
}
}