File tree Expand file tree Collapse file tree 2 files changed +4
-10
lines changed Expand file tree Collapse file tree 2 files changed +4
-10
lines changed Original file line number Diff line number Diff line change @@ -326,22 +326,19 @@ where
326
326
}
327
327
328
328
fn serialize_struct ( self , _name : & ' static str , len : usize ) -> Result < Self :: SerializeStruct > {
329
- if len == 0 {
330
- return StructSerializer :: unit ( self ) . map ( StructSeqSerializer :: Struct ) ;
331
- }
332
-
333
329
self . 0
334
330
. add_padding ( self . 0 . signature . alignment ( self . 0 . ctxt . format ( ) ) ) ?;
335
331
match & self . 0 . signature {
336
332
Signature :: Variant => StructSerializer :: variant ( self ) . map ( StructSeqSerializer :: Struct ) ,
337
333
Signature :: Array ( _) => self . serialize_seq ( Some ( len) ) . map ( StructSeqSerializer :: Seq ) ,
334
+ Signature :: U8 => StructSerializer :: unit ( self ) . map ( StructSeqSerializer :: Struct ) ,
338
335
Signature :: Structure ( _) => {
339
336
StructSerializer :: structure ( self ) . map ( StructSeqSerializer :: Struct )
340
337
}
341
338
Signature :: Dict { .. } => self . serialize_map ( Some ( len) ) . map ( StructSeqSerializer :: Map ) ,
342
339
_ => Err ( Error :: SignatureMismatch (
343
340
self . 0 . signature . clone ( ) ,
344
- "a struct, array or variant" . to_string ( ) ,
341
+ "a struct, array, u8 or variant" . to_string ( ) ,
345
342
) ) ,
346
343
}
347
344
}
Original file line number Diff line number Diff line change @@ -327,23 +327,20 @@ where
327
327
}
328
328
329
329
fn serialize_struct ( self , _name : & ' static str , len : usize ) -> Result < Self :: SerializeStruct > {
330
- if len == 0 {
331
- return StructSerializer :: unit ( self ) . map ( StructSeqSerializer :: Struct ) ;
332
- }
333
-
334
330
self . 0
335
331
. add_padding ( self . 0 . signature . alignment ( self . 0 . ctxt . format ( ) ) ) ?;
336
332
match & self . 0 . signature {
337
333
Signature :: Variant => StructSerializer :: variant ( self ) . map ( StructSeqSerializer :: Struct ) ,
338
334
Signature :: Array ( _) => self . serialize_seq ( Some ( len) ) . map ( StructSeqSerializer :: Seq ) ,
335
+ Signature :: U8 => StructSerializer :: unit ( self ) . map ( StructSeqSerializer :: Struct ) ,
339
336
Signature :: Structure ( _) => {
340
337
StructSerializer :: structure ( self ) . map ( StructSeqSerializer :: Struct )
341
338
}
342
339
Signature :: Dict { .. } => self . serialize_map ( Some ( len) ) . map ( StructSeqSerializer :: Map ) ,
343
340
_ => {
344
341
return Err ( Error :: SignatureMismatch (
345
342
self . 0 . signature . clone ( ) ,
346
- "a struct, array or variant" . to_string ( ) ,
343
+ "a struct, array, u8 or variant" . to_string ( ) ,
347
344
) ) ;
348
345
}
349
346
}
You can’t perform that action at this time.
0 commit comments