From 3018c4a28a68072ff71b6229c7ddb491b1a541f6 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Fri, 8 Jan 2016 11:52:46 +0100 Subject: [PATCH] Additional Populatable API tweaks. --- src/hash.rs | 9 ++------- src/sha3.rs | 4 ++-- src/trie/triedbmut.rs | 2 +- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/hash.rs b/src/hash.rs index e6f9a61c7..2fb4b71e6 100644 --- a/src/hash.rs +++ b/src/hash.rs @@ -10,19 +10,18 @@ use rustc_serialize::hex::*; use error::EthcoreError; use rand::Rng; use rand::os::OsRng; -use bytes::BytesConvertable; +use bytes::{BytesConvertable,Populatable}; use math::log2; use uint::U256; /// Trait for a fixed-size byte array to be used as the output of hash functions. /// /// Note: types implementing `FixedHash` must be also `BytesConvertable`. -pub trait FixedHash: Sized + BytesConvertable { +pub trait FixedHash: Sized + BytesConvertable + Populatable { fn new() -> Self; fn random() -> Self; fn randomize(&mut self); fn size() -> usize; - fn as_slice_mut(&mut self) -> &mut [u8]; fn from_slice(src: &[u8]) -> Self; fn clone_from_slice(&mut self, src: &[u8]) -> usize; fn shift_bloom<'a, T>(&'a mut self, b: &T) -> &'a mut Self where T: FixedHash; @@ -78,10 +77,6 @@ macro_rules! impl_hash { $size } - fn as_slice_mut(&mut self) -> &mut [u8] { - &mut self.0 - } - // TODO: remove once slice::clone_from_slice is stable #[inline] fn clone_from_slice(&mut self, src: &[u8]) -> usize { diff --git a/src/sha3.rs b/src/sha3.rs index e1337c5f7..f3faa4e3b 100644 --- a/src/sha3.rs +++ b/src/sha3.rs @@ -2,8 +2,8 @@ use std::mem::uninitialized; use tiny_keccak::Keccak; -use bytes::BytesConvertable; -use hash::{FixedHash, H256}; +use bytes::{BytesConvertable,Populatable}; +use hash::H256; /// Types implementing this trait are sha3able. /// diff --git a/src/trie/triedbmut.rs b/src/trie/triedbmut.rs index e04b7c758..a51e56a83 100644 --- a/src/trie/triedbmut.rs +++ b/src/trie/triedbmut.rs @@ -668,7 +668,7 @@ mod tests { use env_logger; use rand::random; use std::collections::HashSet; - use bytes::{ToPretty,Bytes}; + use bytes::{ToPretty,Bytes,Populatable}; use super::super::node::*; use super::super::trietraits::*;