Skip to content

Commit

Permalink
Rename string enum variants to camelCase in TryFromRpcValue
Browse files Browse the repository at this point in the history
Closes #24
  • Loading branch information
j4r0u53k authored and syyyr committed Nov 25, 2024
1 parent 226c150 commit acde534
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ workspace = { members = ["libshvproto-macros"] }

[package]
name = "shvproto"
version = "3.0.16"
version = "3.0.17"
edition = "2021"

[dependencies]
Expand Down
5 changes: 3 additions & 2 deletions libshvproto-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,10 +301,11 @@ pub fn derive_from_rpcvalue(item: TokenStream) -> TokenStream {
}
},
syn::Fields::Unit => {
let variant_ident_name = variant_ident.to_string().to_case(Case::Camel);
match_arms_ser.extend(quote!{
#struct_identifier::#variant_ident => shvproto::RpcValue::from(stringify!(#variant_ident)),
#struct_identifier::#variant_ident => shvproto::RpcValue::from(stringify!(#variant_ident_name)),
});
add_type_matcher(&mut match_arms_de, quote!{String(s) if s.as_str() == stringify!(#variant_ident)}, quote!{#variant_ident}, quote!());
add_type_matcher(&mut match_arms_de, quote!{String(s) if s.as_str() == stringify!(#variant_ident_name)}, quote!{#variant_ident}, quote!());
},
syn::Fields::Named(variant_fields) => {
if let Some((matched_variant_ident, matched_variant_type)) = map_has_been_matched_as_map {
Expand Down

0 comments on commit acde534

Please sign in to comment.