Skip to content

Commit

Permalink
also parse fields
Browse files Browse the repository at this point in the history
  • Loading branch information
sam0x17 committed Dec 4, 2024
1 parent bf33ed3 commit eb4bef0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ fn values_impl(input: TokenStream2) -> Result<TokenStream2> {
let struct_name = parsed_input.struct_name;
let generic_param = parsed_input.generic_param;
let dimensions = parsed_input.dimensions;
let fields = parsed_input.fields;

// Generate the struct and implementation
let result = quote! {
Expand Down Expand Up @@ -288,6 +289,7 @@ struct ParsedValuesInput {
pub struct_name: Ident,
pub generic_param: Ident,
pub dimensions: usize,
pub fields: FieldsNamed,
}

impl Parse for ParsedValuesInput {
Expand All @@ -299,8 +301,8 @@ impl Parse for ParsedValuesInput {
let dimensions: LitInt = input.parse()?;
input.parse::<Token![>]>()?;
input.parse::<Token![;]>()?; // Expect a semicolon to terminate the macro input

Ok(ParsedValuesInput { struct_name, generic_param, dimensions: dimensions.base10_parse()? })
let fields: FieldsNamed = input.parse()?;
Ok(ParsedValuesInput { struct_name, generic_param, dimensions: dimensions.base10_parse()?, fields })
}
}

Expand Down

0 comments on commit eb4bef0

Please sign in to comment.