feat: Introduce 'traverse' library (#117)

This commit is contained in:
Santiago Carmuega 2022-06-12 19:09:33 -03:00 committed by GitHub
parent c9489c3ddf
commit 6913efef78
20 changed files with 377 additions and 106 deletions

View file

@ -111,7 +111,7 @@ where
}
/// A struct that maintains a reference to whether a cbor array was indef or not
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord)]
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone)]
pub enum MaybeIndefArray<A> {
Def(Vec<A>),
Indef(Vec<A>),
@ -186,7 +186,7 @@ where
/// transform key-value structures into an orderer vec of `properties`, where
/// each entry represents a a cbor-encodable variant of an attribute of the
/// struct.
#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Clone)]
pub struct OrderPreservingProperties<P>(Vec<P>);
impl<P> Deref for OrderPreservingProperties<P> {
@ -229,7 +229,7 @@ where
}
/// Wraps a struct so that it is encoded/decoded as a cbor bytes
#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct CborWrap<T>(pub T);
impl<'b, C, T> minicbor::Decode<'b, C> for CborWrap<T>
@ -312,7 +312,7 @@ where
/// An empty map
///
/// don't ask me why, that's what the CDDL asks for.
#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct EmptyMap;
impl<'b, C> minicbor::decode::Decode<'b, C> for EmptyMap {
@ -518,7 +518,7 @@ impl From<&AnyUInt> for u64 {
/// let confirm: (u16, u16) = minicbor::decode(keeper.raw_cbor()).unwrap();
/// assert_eq!(confirm, (456u16, 789u16));
/// ```
#[derive(Debug, PartialEq, PartialOrd)]
#[derive(Debug, PartialEq, PartialOrd, Clone)]
pub struct KeepRaw<'b, T> {
raw: &'b [u8],
inner: T,