avoid copy
This commit is contained in:
parent
3d94670f1f
commit
dc4654fa4c
@ -40,7 +40,8 @@ impl Web3 for Web3Client {
|
|||||||
fn sha3(&self, params: Params) -> Result<Value, Error> {
|
fn sha3(&self, params: Params) -> Result<Value, Error> {
|
||||||
from_params::<(Bytes,)>(params).and_then(
|
from_params::<(Bytes,)>(params).and_then(
|
||||||
|(data,)| {
|
|(data,)| {
|
||||||
let sha3 = data.to_vec().sha3();
|
let Bytes(ref v) = data;
|
||||||
|
let sha3 = v.sha3();
|
||||||
to_value(&sha3)
|
to_value(&sha3)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -21,7 +21,7 @@ use util::common::FromHex;
|
|||||||
|
|
||||||
/// Wrapper structure around vector of bytes.
|
/// Wrapper structure around vector of bytes.
|
||||||
#[derive(Debug, PartialEq, Default)]
|
#[derive(Debug, PartialEq, Default)]
|
||||||
pub struct Bytes(Vec<u8>);
|
pub struct Bytes(pub Vec<u8>);
|
||||||
|
|
||||||
impl Bytes {
|
impl Bytes {
|
||||||
/// Simple constructor.
|
/// Simple constructor.
|
||||||
|
Loading…
Reference in New Issue
Block a user