@@ -179,66 +179,6 @@ impl<S: Size> From<Multihash<S>> for Vec<u8> {
179179 }
180180}
181181
182- #[ cfg( feature = "scale-codec" ) ]
183- impl parity_scale_codec:: Encode for Multihash < crate :: U32 > {
184- fn encode_to < EncOut : parity_scale_codec:: Output > ( & self , dest : & mut EncOut ) {
185- let mut digest = [ 0 ; 32 ] ;
186- digest. copy_from_slice ( & self . digest ) ;
187- dest. push ( & self . code ) ;
188- dest. push ( & self . size ) ;
189- dest. push ( & digest) ;
190- }
191- }
192-
193- #[ cfg( feature = "scale-codec" ) ]
194- impl parity_scale_codec:: EncodeLike for Multihash < crate :: U32 > { }
195-
196- #[ cfg( feature = "scale-codec" ) ]
197- impl parity_scale_codec:: Decode for Multihash < crate :: U32 > {
198- fn decode < DecIn : parity_scale_codec:: Input > (
199- input : & mut DecIn ,
200- ) -> Result < Self , parity_scale_codec:: Error > {
201- Ok ( Multihash {
202- code : parity_scale_codec:: Decode :: decode ( input) ?,
203- size : parity_scale_codec:: Decode :: decode ( input) ?,
204- digest : {
205- let digest = <[ u8 ; 32 ] >:: decode ( input) ?;
206- GenericArray :: clone_from_slice ( & digest)
207- } ,
208- } )
209- }
210- }
211-
212- #[ cfg( feature = "scale-codec" ) ]
213- impl parity_scale_codec:: Encode for Multihash < crate :: U64 > {
214- fn encode_to < EncOut : parity_scale_codec:: Output > ( & self , dest : & mut EncOut ) {
215- let mut digest = [ 0 ; 64 ] ;
216- digest. copy_from_slice ( & self . digest ) ;
217- dest. push ( & self . code ) ;
218- dest. push ( & self . size ) ;
219- dest. push ( & digest) ;
220- }
221- }
222-
223- #[ cfg( feature = "scale-codec" ) ]
224- impl parity_scale_codec:: EncodeLike for Multihash < crate :: U64 > { }
225-
226- #[ cfg( feature = "scale-codec" ) ]
227- impl parity_scale_codec:: Decode for Multihash < crate :: U64 > {
228- fn decode < DecIn : parity_scale_codec:: Input > (
229- input : & mut DecIn ,
230- ) -> Result < Self , parity_scale_codec:: Error > {
231- Ok ( Multihash {
232- code : parity_scale_codec:: Decode :: decode ( input) ?,
233- size : parity_scale_codec:: Decode :: decode ( input) ?,
234- digest : {
235- let digest = <[ u8 ; 64 ] >:: decode ( input) ?;
236- GenericArray :: clone_from_slice ( & digest)
237- } ,
238- } )
239- }
240- }
241-
242182/// Writes the multihash to a byte stream.
243183#[ cfg( feature = "std" ) ]
244184pub fn write_multihash < W > ( mut w : W , code : u64 , size : u8 , digest : & [ u8 ] ) -> Result < ( ) , Error >
@@ -299,17 +239,6 @@ mod tests {
299239 assert_eq ! ( hash, hash2) ;
300240 }
301241
302- #[ test]
303- #[ cfg( feature = "scale-codec" ) ]
304- fn test_scale ( ) {
305- use parity_scale_codec:: { Decode , Encode } ;
306-
307- let mh = Multihash :: < crate :: U32 > :: default ( ) ;
308- let bytes = mh. encode ( ) ;
309- let mh2: Multihash < crate :: U32 > = Decode :: decode ( & mut & bytes[ ..] ) . unwrap ( ) ;
310- assert_eq ! ( mh, mh2) ;
311- }
312-
313242 #[ test]
314243 #[ cfg( feature = "serde-codec" ) ]
315244 fn test_serde ( ) {
0 commit comments