diff options
Diffstat (limited to 'src/load_file.rs')
-rw-r--r-- | src/load_file.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/load_file.rs b/src/load_file.rs new file mode 100644 index 0000000..0fd1541 --- /dev/null +++ b/src/load_file.rs @@ -0,0 +1,12 @@ +use std::fs::File; +use std::io::Read; + +pub fn load_file_vec(path: &String) -> std::io::Result<Vec<u8>> +{ + let mut file = File::open(path)?; + let mut data = Vec::new(); + + file.read_to_end(&mut data)?; + + Ok(data) +} |