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:
commit
e3c846eee5
12
src/main.rs
12
src/main.rs
@ -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");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user