Mojo function
get_struct_field_names
get_struct_field_names[T: AnyType]() -> InlineArray[StaticString, get_struct_field_count[T]()]
Returns the names of all fields in struct T as an InlineArray.
This function provides compile-time reflection over struct field names. It returns the names of all fields (including private fields) in declaration order.
Parameters:
- T (
AnyType): A struct type.
Returns:
InlineArray: An InlineArray of StaticStrings, one for each field name in the struct.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!