Merge branch 'volodymyr-dev' into 'master'

func to get file content as Result<String>

See merge request mhart/DancingDroids!9
This commit is contained in:
Martin HART 2020-10-13 10:49:44 +02:00
commit e3c846eee5
1 changed files with 10 additions and 2 deletions

View File

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