1
0
mirror of https://github.com/rm-dr/datapath.git synced 2026-02-18 15:16:58 -08:00
This commit is contained in:
2025-12-03 12:57:10 -08:00
committed by Mark
parent f51162478b
commit 08003a3fbe
8 changed files with 1000 additions and 6 deletions

View File

@@ -549,7 +549,7 @@ fn generate_common_impls(
}
// Extract just the field names for struct construction
let field_names = typed_fields.iter().map(|(name, _)| name);
let field_names: Vec<_> = typed_fields.iter().map(|(name, _)| name).collect();
let datapath_impl = quote! {
impl ::datapath::Datapath for #struct_name {
@@ -600,6 +600,13 @@ fn generate_common_impls(
file,
})
}
fn field(&self, name: &str) -> Option<::std::string::String> {
match name {
#(stringify!(#field_names) => Some(self.#field_names.to_string()),)*
_ => None,
}
}
}
};