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:
swaits committed 2021-12-04 21:59:10 -07:00
1 parent 5a32230b8c
commit 77a9b9fcc5
5 files changed
+20 -31

No files matched your search

+1 -9
View File
@@ -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)?)
}