You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Setting set is a way to change default setting values for some structs or fields without repeating same settings on every node.
Setting sets are defined as an ordered list in the Macon configuration file:
settingsets:
- id: "any"...
- ...
Setting sets are applied in order. The latest overriding the previous ones. The id is optional is only used for debug purpose. It default to setting set order. Each setting set is compound of criteria and settings:
settingsets:
- id: ""# Optionalcriteria: [] # Optional, default to match allsettings: {} # Mandatory
Criteria
A setting set is applied (or retained) if current context (struct or field) matches the given criteria (TBD). Criteria are list of includes or excludes. In order to create exceptions.
# Include first to apply only on matching struct/field
- criteria:
- includes: {} # Apply only if matches
- excludes: {} # Ignore only in previous matches# Exclude first to apply on all except matching struct/field
- criteria:
- excludes: {} # Apply on if not matches
- includes: {} # Retain only in previous matches
Each criterion is key which designate data to match. Then it contains a single key which is operator use for comparison. Supported criteria: (Note: field criteria will never match for struct settings. However, field setting may applied to whole struct fields if criteria are only based on struct.)
keys: structs & fields can have key sets. It matches against the combine set of struct & field ones.
equals: set of keys that must be strictly specified on struct or field (combined).
contains: Sub-set of keys that must be specified on struct or field (combined).
struct_keys: it matches against keys defined at struct level.
equals: set of keys that must be strictly specified on struct.
contains: Sub-set of keys that must be specified on struct.
field_keys: it matches against keys defined at field level.
equals: set of keys that must be strictly specified on field.
contains: Sub-set of keys that must be specified on field.
struct_name: it matches against the struct name.
equals: string value that must equal the struct name.
matches: regular expression that must match the struct name.
field_name: it matches against the field name.
equals: string value that must equal the struct name.
matches: regular expression that must match the struct name.
field_type: canonical string representation of field type tokens. As Rust macros only operate on full text / token, it can't match on full/resolved type pathes; only as text as found in source code.
equals: string value that must equal field type representation.
matches: regular expression that must match field type representation.
Settings
There are divided in two categories: struct and field.
General
Setting set is a way to change default setting values for some structs or fields without repeating same settings on every node.
Setting sets are defined as an ordered list in the Macon configuration file:
Setting sets are applied in order. The latest overriding the previous ones. The
id
is optional is only used for debug purpose. It default to setting set order. Each setting set is compound of criteria and settings:Criteria
A setting set is applied (or retained) if current context (struct or field) matches the given criteria (TBD). Criteria are list of
includes
orexcludes
. In order to create exceptions.Each criterion is key which designate data to match. Then it contains a single key which is operator use for comparison. Supported criteria:
(Note: field criteria will never match for struct settings. However, field setting may applied to whole struct fields if criteria are only based on struct.)
keys
: structs & fields can have key sets. It matches against the combine set of struct & field ones.equals
: set of keys that must be strictly specified on struct or field (combined).contains
: Sub-set of keys that must be specified on struct or field (combined).struct_keys
: it matches against keys defined at struct level.equals
: set of keys that must be strictly specified on struct.contains
: Sub-set of keys that must be specified on struct.field_keys
: it matches against keys defined at field level.equals
: set of keys that must be strictly specified on field.contains
: Sub-set of keys that must be specified on field.struct_name
: it matches against the struct name.equals
: string value that must equal the struct name.matches
: regular expression that must match the struct name.field_name
: it matches against the field name.equals
: string value that must equal the struct name.matches
: regular expression that must match the struct name.field_type
: canonical string representation of field type tokens. As Rust macros only operate on full text / token, it can't match on full/resolved type pathes; only as text as found in source code.equals
: string value that must equal field type representation.matches
: regular expression that must match field type representation.Settings
There are divided in two categories:
struct
andfield
.Supported
struct
settings:Default
: boolean indicating if struct derivesDefault
. SeeDefault
struct.Supported
field
settings:Option
:false
or"!"
to disableOption
support. SeeOption
fields.<any string>
to enforceOption
support. SeeOption
fields.Default
: boolean indicating if field derivesDefault
. SeeDefault
fields.Into
: Onlyfalse
or"!"
is supported. DisableInto
for field setter. SeeInto
argument.When several setting sets matches, all their settings are applied in order of appearance (the lastest overriding previous ones).
For example:
Priority
Setting may come from several sources (the first find is used):
The text was updated successfully, but these errors were encountered: