Skip to main content

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:

Returns:

InlineArray: An InlineArray of StaticStrings, one for each field name in the struct.

Was this page helpful?