#[derive(FieldNames)]Expand description
Generates methods for retrieving field names of a struct as string literals.
This function is used as part of a procedural macro. It takes a struct definition,
extracts its named fields, and generates a method for each field. Each generated method
follows the naming pattern nameof_<field_name>(), which returns the field name as a static string.
§Example
use quick_macros::FieldNames;
#[derive(FieldNames)]
struct Person {
name: String,
age: u32,
}
assert_eq!(Person::nameof_name(), "name");
assert_eq!(Person::nameof_age(), "age");§Panics
- If the macro is applied to a non-struct type (e.g., an enum or union), it will panic.