@@ -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,12 @@ 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; _decode_tlv!( $outer_reader, $reader, $field, option) ;
389
+ } } ;
390
+ ( $outer_reader: expr, $reader: expr, $field: ident, ( required, explicit_type: $fieldty: ty) ) => { {
391
+ let _field: $fieldty = $field; _decode_tlv!( $outer_reader, $reader, $field, required) ;
392
+ } } ;
375
393
( $outer_reader: expr, $reader: expr, $field: ident, optional_vec) => { {
376
394
let f: $crate:: util:: ser:: WithoutLength <Vec <_>> = $crate:: util:: ser:: Readable :: read( & mut $reader) ?;
377
395
$field = Some ( f. 0 ) ;
@@ -795,6 +813,12 @@ macro_rules! _init_tlv_field_var {
795
813
( $field: ident, optional_vec) => {
796
814
let mut $field = Some ( Vec :: new( ) ) ;
797
815
} ;
816
+ ( $field: ident, ( option, explicit_type: $fieldty: ty) ) => {
817
+ let mut $field: Option <$fieldty> = None ;
818
+ } ;
819
+ ( $field: ident, ( required, explicit_type: $fieldty: ty) ) => {
820
+ let mut $field = $crate:: util:: ser:: RequiredWrapper :: <$fieldty>( None ) ;
821
+ } ;
798
822
( $field: ident, ( option, encoding: ( $fieldty: ty, $encoding: ident) ) ) => {
799
823
$crate:: _init_tlv_field_var!( $field, option) ;
800
824
} ;
0 commit comments