func to get file content as Result<String>

This commit is contained in:
Volodymyr Patuta 2020-10-13 10:19:34 +02:00
parent 236f9c7ecf
commit 630e5e05b1
1 changed files with 7 additions and 2 deletions

View File

@ -30,6 +30,11 @@ fn parse_instruction(c: char) -> Result<Instruction, &'static str> {
}
}
fn main() {
let file_data = include_str!("../two_robots.txt");
fn open_file(filename: &str) -> io::Result<String> {
let content = fs::read_to_string(filename)?;
Ok(content)
}
fn main() {
let conf = open_file("two_robots.txt");
}