func to get file content as Result<String>
This commit is contained in:
parent
236f9c7ecf
commit
630e5e05b1
@ -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");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user