Skip to content

Commit

Permalink
build: parser: Add serde serialization
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick José Pereira <[email protected]>
  • Loading branch information
patrickelectric committed May 23, 2024
1 parent e03dfeb commit d124d62
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions build/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ fn emit_ping_message(messages: HashMap<&String, &MessageDefinition>) -> TokenStr
.iter()
.map(|(name, _message)| {
let pascal_message_name = ident!(name.to_case(Case::Pascal));
quote!(Messages::#pascal_message_name(content) => content.serialize(),)
quote!(Messages::#pascal_message_name(content) => (content as &dyn SerializePayload).serialize(),)
})
.collect::<Vec<TokenStream>>();

Expand All @@ -505,7 +505,7 @@ fn emit_ping_message(messages: HashMap<&String, &MessageDefinition>) -> TokenStr
let id = message.id;

quote! {
#id => Messages::#pascal_message_name(#struct_name::deserialize(payload)),
#id => Messages::#pascal_message_name(<#struct_name as DeserializePayload>::deserialize(payload)),
}
})
.collect::<Vec<TokenStream>>();
Expand Down

0 comments on commit d124d62

Please sign in to comment.