Skip to content

Commit

Permalink
fix: hex compatibility (#244)
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniPopes authored Aug 23, 2023
1 parent bf77435 commit 4d636c5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions crates/primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,7 @@ arbitrary = [
"dep:proptest",
"dep:proptest-derive",
]

# `const-hex` compatibility feature for `hex`.
# Should not be needed most of the time.
hex-compat = ["hex/hex"]
4 changes: 3 additions & 1 deletion crates/primitives/src/bits/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,9 @@ macro_rules! impl_fb_traits {
where
T: $crate::private::AsRef<[u8]>
{
$crate::hex::FromHex::from_hex(hex).map(Self)
let mut buf = [0u8; $n];
$crate::hex::decode_to_slice(hex.as_ref(), &mut buf)?;
Ok(Self::new(buf))
}
}
};
Expand Down

0 comments on commit 4d636c5

Please sign in to comment.