--chain option for setting which network to go on.
Add contents function to util.
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
//! Diff misc.
|
||||
|
||||
use std::fs::File;
|
||||
use common::*;
|
||||
|
||||
#[derive(Debug,Clone,PartialEq,Eq)]
|
||||
@@ -53,3 +54,11 @@ pub enum Filth {
|
||||
/// Data has been changed.
|
||||
Dirty,
|
||||
}
|
||||
|
||||
/// Read the whole contents of a file `name`.
|
||||
pub fn contents(name: &str) -> Result<Bytes, UtilError> {
|
||||
let mut file = try!(File::open(name));
|
||||
let mut ret: Vec<u8> = Vec::new();
|
||||
try!(file.read_to_end(&mut ret));
|
||||
Ok(ret)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user