Skip to content

Commit

Permalink
Bump parity-scale-codec to v2
Browse files Browse the repository at this point in the history
Signed-off-by: koushiro <koushiro.cqx@gmail.com>
  • Loading branch information
koushiro authored and vmx committed May 26, 2021
1 parent 9bfa201 commit db813e2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
12 changes: 5 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ strobe = ["strobe-rs"]

[dependencies]
generic-array = "0.14.4"
parity-scale-codec = { version = "1.3.5", optional = true, default-features = false, features = ["derive"] }
parity-scale-codec = { version = "2.1.1", default-features = false, features = ["derive"], optional = true }
quickcheck = { version = "0.9.2", optional = true }
rand = { version = "0.7.3", optional = true }
serde = { version = "1.0.116", optional = true, default-features = false, features = ["derive"] }
multihash-derive = { version = "^0.7.1", path = "derive", default-features = false, optional = true }
unsigned-varint = "0.7.0"
serde = { version = "1.0.116", default-features = false, features = ["derive"], optional = true }
multihash-derive = { version = "0.7.1", path = "derive", default-features = false, optional = true }
unsigned-varint = { version = "0.7.0", default-features = false }

blake2b_simd = { version = "0.5.10", default-features = false, optional = true }
blake2s_simd = { version = "0.5.10", default-features = false, optional = true }
Expand All @@ -47,13 +47,11 @@ digest = { version = "0.9.0", default-features = false, optional = true }
sha-1 = { version = "0.9.1", default-features = false, optional = true }
sha-2 = { version = "0.9.0", default-features = false, optional = true, package = "sha2" }
sha-3 = { version = "0.9.0", default-features = false, optional = true, package = "sha3" }
strobe-rs = { version = "0.6.2", optional = true }
strobe-rs = { version = "0.6.2", default-features = false, optional = true }

[dev-dependencies]
criterion = "0.3.3"
hex = "0.4.2"
quickcheck = "0.9.2"
rand = "0.7.3"
serde_json = "1.0.58"

[[bench]]
Expand Down
16 changes: 8 additions & 8 deletions src/multihash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,12 @@ impl<S: Size> From<Multihash<S>> for Vec<u8> {

#[cfg(feature = "scale-codec")]
impl parity_scale_codec::Encode for Multihash<crate::U32> {
fn encode_to<EncOut: parity_scale_codec::Output>(&self, dest: &mut EncOut) {
fn encode_to<EncOut: parity_scale_codec::Output + ?Sized>(&self, dest: &mut EncOut) {
let mut digest = [0; 32];
digest.copy_from_slice(&self.digest);
dest.push(&self.code);
dest.push(&self.size);
dest.push(&digest);
self.code.encode_to(dest);
self.size.encode_to(dest);
digest.encode_to(dest);
}
}

Expand All @@ -211,12 +211,12 @@ impl parity_scale_codec::Decode for Multihash<crate::U32> {

#[cfg(feature = "scale-codec")]
impl parity_scale_codec::Encode for Multihash<crate::U64> {
fn encode_to<EncOut: parity_scale_codec::Output>(&self, dest: &mut EncOut) {
fn encode_to<EncOut: parity_scale_codec::Output + ?Sized>(&self, dest: &mut EncOut) {
let mut digest = [0; 64];
digest.copy_from_slice(&self.digest);
dest.push(&self.code);
dest.push(&self.size);
dest.push(&digest);
self.code.encode_to(dest);
self.size.encode_to(dest);
digest.encode_to(dest);
}
}

Expand Down

0 comments on commit db813e2

Please sign in to comment.