it: read_entire_file use built in
This commit is contained in:
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
use std::io::{Cursor,Read};
|
use std::io::Cursor;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::time::Instant;
|
use std::time::Instant;
|
||||||
|
|
||||||
@ -39,9 +39,7 @@ impl From<strafesnet_snf::bot::Error> for ReplayError{
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn read_entire_file(path:impl AsRef<Path>)->Result<Cursor<Vec<u8>>,std::io::Error>{
|
fn read_entire_file(path:impl AsRef<Path>)->Result<Cursor<Vec<u8>>,std::io::Error>{
|
||||||
let mut file=std::fs::File::open(path)?;
|
let data=std::fs::read(path)?;
|
||||||
let mut data=Vec::new();
|
|
||||||
file.read_to_end(&mut data)?;
|
|
||||||
Ok(Cursor::new(data))
|
Ok(Cursor::new(data))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user