@@ -281,6 +281,12 @@ macro_rules! _check_decoded_tlv_order {
281
281
( $last_seen_type: expr, $typ: expr, $type: expr, $field: ident, option) => { {
282
282
// no-op
283
283
} } ;
284
+ ( $last_seen_type: expr, $typ: expr, $type: expr, $field: ident, ( option, explicit_type: $fieldty: ty) ) => { {
285
+ // no-op
286
+ } } ;
287
+ ( $last_seen_type: expr, $typ: expr, $type: expr, $field: ident, ( required, explicit_type: $fieldty: ty) ) => { {
288
+ _check_decoded_tlv_order!( $last_seen_type, $typ, $type, $field, required) ;
289
+ } } ;
284
290
( $last_seen_type: expr, $typ: expr, $type: expr, $field: ident, required_vec) => { {
285
291
$crate:: _check_decoded_tlv_order!( $last_seen_type, $typ, $type, $field, required) ;
286
292
} } ;
@@ -332,6 +338,12 @@ macro_rules! _check_missing_tlv {
332
338
( $last_seen_type: expr, $type: expr, $field: ident, option) => { {
333
339
// no-op
334
340
} } ;
341
+ ( $last_seen_type: expr, $type: expr, $field: ident, ( option, explicit_type: $fieldty: ty) ) => { {
342
+ // no-op
343
+ } } ;
344
+ ( $last_seen_type: expr, $type: expr, $field: ident, ( required, explicit_type: $fieldty: ty) ) => { {
345
+ _check_missing_tlv!( $last_seen_type, $type, $field, required) ;
346
+ } } ;
335
347
( $last_seen_type: expr, $type: expr, $field: ident, optional_vec) => { {
336
348
// no-op
337
349
} } ;
@@ -372,6 +384,14 @@ macro_rules! _decode_tlv {
372
384
( $outer_reader: expr, $reader: expr, $field: ident, option) => { {
373
385
$field = Some ( $crate:: util:: ser:: Readable :: read( & mut $reader) ?) ;
374
386
} } ;
387
+ ( $outer_reader: expr, $reader: expr, $field: ident, ( option, explicit_type: $fieldty: ty) ) => { {
388
+ let _field: & Option <$fieldty> = & $field;
389
+ _decode_tlv!( $outer_reader, $reader, $field, option) ;
390
+ } } ;
391
+ ( $outer_reader: expr, $reader: expr, $field: ident, ( required, explicit_type: $fieldty: ty) ) => { {
392
+ let _field: & $fieldty = & $field;
393
+ _decode_tlv!( $outer_reader, $reader, $field, required) ;
394
+ } } ;
375
395
( $outer_reader: expr, $reader: expr, $field: ident, optional_vec) => { {
376
396
let f: $crate:: util:: ser:: WithoutLength <Vec <_>> = $crate:: util:: ser:: Readable :: read( & mut $reader) ?;
377
397
$field = Some ( f. 0 ) ;
@@ -795,6 +815,12 @@ macro_rules! _init_tlv_field_var {
795
815
( $field: ident, optional_vec) => {
796
816
let mut $field = Some ( Vec :: new( ) ) ;
797
817
} ;
818
+ ( $field: ident, ( option, explicit_type: $fieldty: ty) ) => {
819
+ let mut $field: Option <$fieldty> = None ;
820
+ } ;
821
+ ( $field: ident, ( required, explicit_type: $fieldty: ty) ) => {
822
+ let mut $field = $crate:: util:: ser:: RequiredWrapper :: <$fieldty>( None ) ;
823
+ } ;
798
824
( $field: ident, ( option, encoding: ( $fieldty: ty, $encoding: ident) ) ) => {
799
825
$crate:: _init_tlv_field_var!( $field, option) ;
800
826
} ;
0 commit comments