fix: Provide original hash for inline datum (#221)

This commit is contained in:
Santiago Carmuega 2023-02-03 18:58:39 +01:00 committed by GitHub
parent 9d8ca617ef
commit e600190107
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 216 additions and 110 deletions

View file

@ -98,8 +98,8 @@ where
impl<'b, C, K, V> minicbor::decode::Decode<'b, C> for KeyValuePairs<K, V>
where
K: Encode<C> + Decode<'b, C> + Clone,
V: Encode<C> + Decode<'b, C> + Clone,
K: Decode<'b, C> + Clone,
V: Decode<'b, C> + Clone,
{
fn decode(d: &mut minicbor::Decoder<'b>, ctx: &mut C) -> Result<Self, minicbor::decode::Error> {
let datatype = d.datatype()?;
@ -153,7 +153,7 @@ where
}
/// A struct that maintains a reference to whether a cbor array was indef or not
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone)]
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, PartialOrd, Ord, Clone)]
pub enum MaybeIndefArray<A> {
Def(Vec<A>),
Indef(Vec<A>),
@ -290,6 +290,12 @@ where
#[serde(transparent)]
pub struct CborWrap<T>(pub T);
impl<T> CborWrap<T> {
pub fn unwrap(self) -> T {
self.0
}
}
impl<'b, C, T> minicbor::Decode<'b, C> for CborWrap<T>
where
T: minicbor::Decode<'b, C>,