| 1 | fn isFieldOptional(comptime T: type, field_index: usize) !bool { |
| 2 | const field_types = @typeInfo(T).@"struct".field_types; |
| 3 | return switch (field_index) { |
| 4 | inline 0...field_types.len - 1 => |idx| @typeInfo(field_types[idx]) == .optional, |
| 5 | else => return error.IndexOutOfBounds, |
| 6 | }; |
| 7 | } |
| 8 | |
| 9 | // syntax |