Crates.io | settings-schema-derive |
lib.rs | settings-schema-derive |
version | 0.2.0 |
source | src |
created_at | 2022-03-21 15:09:37.724011 |
updated_at | 2023-04-02 20:50:33.578083 |
description | proc-macro crate for settings-schema |
homepage | |
repository | https://github.com/zarik5/settings-schema-rs |
max_upload_size | |
id | 554148 |
size | 26,049 |
Derive macro for generating automatically a schema from Rust structures and enums. The schema can be serialized to JSON and/or used to generate a GUI.
struct
). Contains fields that can be marked as advanced setting. Unnamed fields are not supported.enum
). Up to one unnamed field per variant is supported. Can be marked with the gui
attribute with "drop_down"
or "button_group"
.Option
). None
is used when the content is "default" or calculated.Enabled
(with data) or Disabled
. The content can be set to advanced.bool
).u/i 8/32/64/size
and f32/f64
). Attribute gui
can be textbox
or slider
(with sub attribtes min
, max
, step
and logarithmic
).String
).[X; N]
).Vec<X>
).Vec<(String, X)>
).Attributes like gui
can be applied to fields with compound types like Vec<Switch<u64>>
.
Custom types with generic type arguments are not supported.
New *Default
structures are automatically created to store default values. This is done to allow specifying the default data for all variants in a given enum.