ParthibanRajasekaran commented on code in PR #4350:
URL: https://github.com/apache/iggy/pull/4350#discussion_r4146311033
##########
core/configs_derive/src/config_env.rs:
##########
@@ -359,6 +389,48 @@ fn generate_struct_impl(
}
};
+ let own_template_entries = mappings.iter().map(|mapping| {
+ let env_suffix = &mapping.env_suffix;
+ quote! {
+ configs::EnvVarTemplate { env_name: #env_suffix, max_elements: &[]
}
+ }
+ });
+ let nested_template_extends = nested_fields.iter().map(|info| {
+ let ty = &info.element_type;
+ let segment = &info.field_env_segment;
+ if info.is_vec {
+ let max_elements = info.max_elements;
+ quote! {
+ for template in <#ty as
configs::ConfigEnvMappings>::env_templates() {
+ let env_name = Box::leak(format!("{}_<N>_{}", #segment,
template.env_name).into_boxed_str());
+ let limits = Box::leak(std::iter::once(#max_elements)
+ .chain(template.max_elements.iter().copied())
+ .collect::<Vec<_>>()
+ .into_boxed_slice());
+ all_templates.push(configs::EnvVarTemplate { env_name,
max_elements: limits });
+ }
+ }
+ } else {
+ quote! {
+ for template in <#ty as
configs::ConfigEnvMappings>::env_templates() {
+ let env_name = Box::leak(format!("{}_{}", #segment,
template.env_name).into_boxed_str());
+ all_templates.push(configs::EnvVarTemplate {
Review Comment:
Added max_elements: template.max_elements, to the struct literal after line
418, mirroring the Vec branch pattern. This restores the field that was
inadvertently deleted in a prior simplification.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]