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