@@ -32,18 +32,11 @@ where
3232 signature : coset:: CoseSign ,
3333}
3434
35- /// A UUID struct, CBOR tag 37.
36- #[ derive( Debug , Clone , PartialEq ) ]
37- pub struct Uuid ( pub Vec < u8 > ) ;
38-
3935/// An encoded CBOR struct, CBOR tag 24.
4036#[ derive( Debug , Clone , PartialEq ) ]
4137pub struct EncodedCbor < T > ( T )
4238where T : for < ' a > Cbor < ' a > ;
4339
44- /// UUID CBOR tag <https://www.iana.org/assignments/cbor-tags/cbor-tags.xhtml/>.
45- const UUID_TAG : u64 = 37 ;
46-
4740/// encoded-cbor CBOR tag <https://www.iana.org/assignments/cbor-tags/cbor-tags.xhtml/>.
4841const ENCODED_CBOR_TAG : u64 = 24 ;
4942
@@ -116,30 +109,6 @@ where
116109 }
117110}
118111
119- impl Decode < ' _ , ( ) > for Uuid {
120- fn decode ( d : & mut Decoder < ' _ > , ( ) : & mut ( ) ) -> Result < Self , minicbor:: decode:: Error > {
121- let tag = d. tag ( ) ?;
122- if UUID_TAG != tag. as_u64 ( ) {
123- return Err ( minicbor:: decode:: Error :: message ( format ! (
124- "tag value must be: {UUID_TAG}, provided: {}" ,
125- tag. as_u64( ) ,
126- ) ) ) ;
127- }
128- let choice = d. bytes ( ) ?. to_vec ( ) ;
129- Ok ( Self ( choice) )
130- }
131- }
132-
133- impl Encode < ( ) > for Uuid {
134- fn encode < W : minicbor:: encode:: Write > (
135- & self , e : & mut minicbor:: Encoder < W > , ( ) : & mut ( ) ,
136- ) -> Result < ( ) , minicbor:: encode:: Error < W :: Error > > {
137- e. tag ( Tag :: new ( UUID_TAG ) ) ?;
138- e. bytes ( & self . 0 ) ?;
139- Ok ( ( ) )
140- }
141- }
142-
143112impl < T > Decode < ' _ , ( ) > for EncodedCbor < T >
144113where T : for < ' a > Cbor < ' a >
145114{
@@ -200,6 +169,7 @@ mod tests {
200169 use test_strategy:: proptest;
201170
202171 use super :: * ;
172+ use crate :: uuid:: Uuid ;
203173
204174 type ChoiceT = Vec < u8 > ;
205175 type ProofT = Vec < u8 > ;
0 commit comments