@@ -60,6 +60,9 @@ macro_rules! _encode_tlv {
6060 // Just a read-mapped type
6161 $crate:: _encode_tlv!( $stream, $type, $field, option) ;
6262 } ;
63+ ( $stream: expr, $type: expr, $field: expr, option_without_length) => {
64+ $crate:: _encode_tlv!( $stream, $type, $field. as_ref( ) . map( |x| $crate:: util:: ser:: WithoutLength ( x) ) , option) ;
65+ } ;
6366}
6467
6568/// Panics if the last seen TLV type is not numerically less than the TLV type currently being checked.
@@ -233,6 +236,9 @@ macro_rules! _check_decoded_tlv_order {
233236 ( $last_seen_type: expr, $typ: expr, $type: expr, $field: ident, option) => { {
234237 // no-op
235238 } } ;
239+ ( $last_seen_type: expr, $typ: expr, $type: expr, $field: ident, option_without_length) => { {
240+ // no-op
241+ } } ;
236242 ( $last_seen_type: expr, $typ: expr, $type: expr, $field: ident, vec_type) => { {
237243 // no-op
238244 } } ;
@@ -284,6 +290,9 @@ macro_rules! _check_missing_tlv {
284290 ( $last_seen_type: expr, $type: expr, $field: ident, option) => { {
285291 // no-op
286292 } } ;
293+ ( $last_seen_type: expr, $type: expr, $field: ident, option_without_length) => { {
294+ // no-op
295+ } } ;
287296 ( $last_seen_type: expr, $type: expr, $field: ident, optional_vec) => { {
288297 // no-op
289298 } } ;
@@ -324,6 +333,10 @@ macro_rules! _decode_tlv {
324333 ( $reader: expr, $field: ident, option) => { {
325334 $field = Some ( $crate:: util:: ser:: Readable :: read( & mut $reader) ?) ;
326335 } } ;
336+ ( $reader: expr, $field: ident, option_without_length) => { {
337+ let f: $crate:: util:: ser:: WithoutLength <_> = $crate:: util:: ser:: Readable :: read( & mut $reader) ?;
338+ $field = Some ( f. 0 ) ;
339+ } } ;
327340 ( $reader: expr, $field: ident, optional_vec) => { {
328341 $crate:: _decode_tlv!( $reader, $field, vec_type) ;
329342 } } ;
@@ -679,6 +692,9 @@ macro_rules! _init_tlv_based_struct_field {
679692 ( $field: ident, option) => {
680693 $field
681694 } ;
695+ ( $field: ident, option_without_length) => {
696+ WithoutLength ( $field)
697+ } ;
682698 ( $field: ident, ( option: $trait: ident $( , $read_arg: expr) ?) ) => {
683699 $crate:: _init_tlv_based_struct_field!( $field, option)
684700 } ;
@@ -723,6 +739,9 @@ macro_rules! _init_tlv_field_var {
723739 ( $field: ident, option) => {
724740 let mut $field = None ;
725741 } ;
742+ ( $field: ident, option_without_length) => {
743+ let mut $field = None ;
744+ } ;
726745 ( $field: ident, optional_vec) => {
727746 let mut $field = Some ( Vec :: new( ) ) ;
728747 } ;
0 commit comments