Merge branch 'master' into close_gently
Conflicts: parity/main.rs
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)
|
||||
}
|
||||
|
||||
@@ -458,7 +458,8 @@ macro_rules! construct_uint {
|
||||
let mut hex = "0x".to_owned();
|
||||
let mut bytes = [0u8; 8 * $n_words];
|
||||
self.to_bytes(&mut bytes);
|
||||
hex.push_str(bytes.to_hex().as_ref());
|
||||
let len = cmp::max((self.bits() + 7) / 8, 1);
|
||||
hex.push_str(bytes[bytes.len() - len..].to_hex().as_ref());
|
||||
serializer.visit_str(hex.as_ref())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user