// @typeInfo(Circle).@"struct".fields
//
// This will be an array of StructFields.
- const fields = ???;
+ const fields = @typeInfo(@TypeOf(tuple)).@"struct".fields;
// 2. Loop through each field. This must be done at compile
// time.
//
// Hint: remember 'inline' loops?
//
- for (fields) |field| {
+ inline for (fields) |field| {
// 3. Print the field's name, type, and value.
//
// Each 'field' in this loop is one of these:
//
// The first field should print as: "0"(bool):true
print("\"{s}\"({any}):{any} ", .{
- field.???,
- field.???,
- ???,
+ field.name,
+ field.type,
+ @field(tuple, field.name),
});
}
}