avoid copy

This commit is contained in:
NikVolf 2016-03-26 03:15:27 +03:00 committed by Gav Wood
parent 0340466f5f
commit 4f71fd5d4d
2 changed files with 3 additions and 2 deletions

View File

@ -40,7 +40,8 @@ impl Web3 for Web3Client {
fn sha3(&self, params: Params) -> Result<Value, Error> {
from_params::<(Bytes,)>(params).and_then(
|(data,)| {
let sha3 = data.to_vec().sha3();
let Bytes(ref v) = data;
let sha3 = v.sha3();
to_value(&sha3)
}
)

View File

@ -21,7 +21,7 @@ use util::common::FromHex;
/// Wrapper structure around vector of bytes.
#[derive(Debug, PartialEq, Default)]
pub struct Bytes(Vec<u8>);
pub struct Bytes(pub Vec<u8>);
impl Bytes {
/// Simple constructor.