DVUI

struct_ui

A group of functions for displaying and editing values in structs

The main structs and functions are: fn displayStruct() which can be used to recursively display and/or edit all values in a struct. union FieldOptions are used to control how each field is displayed or edited. fn StructOptions(T) generates a set of FieldOptions for a struct.

string_map holds any heap-allocated memory created when strings are modified. These are automatically cleaned up during Window.deinit().

Types

#
FieldOptions

Field options control whether and how fields are displayed.

StandardFieldOptions

Standard field options allow control of the display mode and

NumberFieldOptions

Controls how numeric fields are displayed.

BoolFieldOptions

Options for displaying a text field.

TextFieldOptions

Options for displaying a text field.

OptionalFieldOptions

Optional field options can provide separate field options for both

Namespaces

#

Type Functions

#
StructOptions

Creates a default set of field options for a struct or union.

UnionTagType

Returns the enum type associated with a tagged union

Functions

#
numberFieldWidget

Display a numeric field

numberFieldWidgetOptional

Display a numeric field

textFieldWidget

Display slices and/or arrays of u8 and const u8.

unionFieldWidget

Allow the selection of the active union member.

optionalFieldWidget

Display an optional

displayField

Display a field within a container.

displayNumber

Display numeric fields, ints and floats.

displayString

Display []u8, []const u8 and arrays of u8 and const u8.

displayStringBuf

Same as displayString, but uses a user-supplied buffer, rather than a dynamically allocated buffer.

displayUnion

Display a union.

displayOptional

Display an optional

displayStruct

Display a struct and allow the user to view and/or edit the fields.

displayContainer

Create and expander to display a container field and indent the container's fields.

defaultValue

Create a default value for a field from either default field initialization values or from struct_options

validFieldOptionsType

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

validateFieldPtrType

Validate if the @typeInfo() of the passed in field_value_ptr

validateFieldPtrTypeSlice

Validate is a pointer to a slice

validateFieldPtrTypeString

Validate is a pointer to a u8 slice.

findMatchingStructOption

Returns the option from the passed in options tuple for type T.

stringBackingAllocator

Returns a 'gpa' backing type with required allocator.

deinit

Free any strings allocated by struct_ui.

testCompileErrors

This used to test the various comptime error messages.

Variables

#
string_map

Stores all strings currently allocated by struct_ui.