You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Setting 2 or more empty list is causing an issue where the 2nd item and rest is referencing the type of direct_io.
#[serde_inline_default]#[derive(Debug,Default,Serialize,Deserialize)]structConfig{#[serde_inline_default(vec![])]pubdirect_io:Vec<DirectIo>,#[serde_inline_default(vec![])]pubjson_output:Vec<JsonOutput>,
......... Other fields
}
I can see in expand_struct, you are reusing the same value if it exists, can i ask why?
I mean, i can understand why, maybe just do them on primitive types?
pub(crate)fn expand_struct(mutitem:ItemStruct) -> proc_macro::TokenStream{letmut inline_fns:Vec<(String,TokenStream,TokenStream)> = vec![];for(i, field)in item.fields.iter_mut().enumerate(){for(j, attr)in field.attrs.iter_mut().enumerate(){if !attr.path().is_ident("serde_inline_default"){continue;}let default:TokenStream = attr.parse_args().unwrap();// we check here if a function with the exact same return value already exists. if so, // this function gets used.let fn_name_lit = ifletSome((fn_name_lit, _, _)) = inline_fns
.iter().find(|(_, def, _)| def.to_string() == default.to_string()) <--------- HERE{
fn_name_lit.clone()}else{
The text was updated successfully, but these errors were encountered:
Thanks for the issue report! I did this to reduce the number of total functions, which may improve compile time (haven't tested it tho, maybe the rust compiler itself optimizes this too).
The new version 0.2.3 has a fix for it. I removed said logic completely. After looking into the generated assembly it seems that the compiler optimizes it itself (mostly by inlining the code).
Setting 2 or more empty list is causing an issue where the 2nd item and rest is referencing the type of direct_io.
I can see in expand_struct, you are reusing the same value if it exists, can i ask why?
I mean, i can understand why, maybe just do them on primitive types?
The text was updated successfully, but these errors were encountered: