move to include_str!() macro for all data
Move away from I/O to just including the data in the program via macro.
This commit is contained in:
5 files changed
+20
-31
No files matched your search
+1
-9
@@ -1,9 +1,5 @@
|
||||
use anyhow::Result;
|
||||
use std::{fs, str::FromStr};
|
||||
|
||||
pub fn read_data<T: FromStr>(filename: &str) -> Result<Vec<T>> {
|
||||
parse_data(&read_file(filename)?)
|
||||
}
|
||||
use std::str::FromStr;
|
||||
|
||||
pub fn parse_data<T: FromStr>(s: &str) -> Result<Vec<T>> {
|
||||
let mut ret = Vec::new();
|
||||
@@ -16,7 +12,3 @@ pub fn parse_data<T: FromStr>(s: &str) -> Result<Vec<T>> {
|
||||
}
|
||||
Ok(ret)
|
||||
}
|
||||
|
||||
pub fn read_file(filename: &str) -> Result<String> {
|
||||
Ok(fs::read_to_string(filename)?)
|
||||
}
|
||||
Reference in new issue
Block a user