($type:ty) => { &'a $type };
}
+#[doc(hidden)]
+#[macro_export]
macro_rules! _impl_writeable_tlv_based_enum_common {
($st: ident, $(($variant_id: expr, $variant_name: ident) =>
{$(($type: expr, $field: ident, $fieldty: tt)),* $(,)*}
$($st::$variant_name { $(ref $field),* } => {
let id: u8 = $variant_id;
id.write(writer)?;
- write_tlv_fields!(writer, {
+ $crate::write_tlv_fields!(writer, {
$(($type, *$field, $fieldty)),*
});
}),*
{$(($type: expr, $field: ident, $fieldty: tt)),* $(,)*}
),* $(,)*;
$(($tuple_variant_id: expr, $tuple_variant_name: ident)),* $(,)*) => {
- _impl_writeable_tlv_based_enum_common!($st,
+ $crate::_impl_writeable_tlv_based_enum_common!($st,
$(($variant_id, $variant_name) => {$(($type, $field, $fieldty)),*}),*;
$(($tuple_variant_id, $tuple_variant_name)),*);
// Because read_tlv_fields creates a labeled loop, we cannot call it twice
// in the same function body. Instead, we define a closure and call it.
let f = || {
- _init_and_read_tlv_fields!(reader, {
+ $crate::_init_and_read_tlv_fields!(reader, {
$(($type, $field, $fieldty)),*
});
Ok($st::$variant_name {
$(
- $field: _init_tlv_based_struct_field!($field, $fieldty)
+ $field: $crate::_init_tlv_based_struct_field!($field, $fieldty)
),*
})
};
),* $(,)*
$(;
$(($tuple_variant_id: expr, $tuple_variant_name: ident)),* $(,)*)*) => {
- _impl_writeable_tlv_based_enum_common!($st,
+ $crate::_impl_writeable_tlv_based_enum_common!($st,
$(($variant_id, $variant_name) => {$(($type, $field, $fieldty)),*}),*;
$($(($tuple_variant_id, $tuple_variant_name)),*)*);
// Because read_tlv_fields creates a labeled loop, we cannot call it twice
// in the same function body. Instead, we define a closure and call it.
let f = || {
- _init_and_read_tlv_fields!(reader, {
+ $crate::_init_and_read_tlv_fields!(reader, {
$(($type, $field, $fieldty)),*
});
Ok(Some($st::$variant_name {
$(
- $field: _init_tlv_based_struct_field!($field, $fieldty)
+ $field: $crate::_init_tlv_based_struct_field!($field, $fieldty)
),*
}))
};