DVUI

validFieldOptionsType

Return true if the field_option is valid for this type of field.

Parameters

#
field_name:[]const u8
[]const u8
field_option:FieldOptions
FieldOptions
required_tag:@typeInfo(FieldOptions).@"union".tag_type.?
@typeInfo(FieldOptions).@"union".tag_type.?

Source

Implementation

#
pub fn validFieldOptionsType(field_name: []const u8, field_option: FieldOptions, required_tag: @typeInfo(FieldOptions).@"union".tag_type.?) bool {
    if (field_option != required_tag) {
        log.debug("Field {s} has FieldOption type {s} but needs {s}. Field will not be displayed\n", .{
            field_name,
            @tagName(field_option),
            @tagName(required_tag),
        });
        return false;
    }
    return true;
}