Expand description
This crate contains the [OhMyToml] derive macro
§Attributes
§Field attributes
defaultordefault = value: If the field is missing then the default value for the field will be usedon_default = "error": If thedefaultvalue is used, then an error will be reported - but we still get our data. This allows for error recovery.rename = "...": Renames this field. When checking for keys in the TOML, we will expect the renamed value.
§Container attributes
default_all: Appliesdefaultto each field- To opt-out for a single field, use
require
- To opt-out for a single field, use
on_default_all = "error": Applieson_default = "error"to each field- To opt-out for a single field, use
on_default = "ok"on the field
- To opt-out for a single field, use
rename_all = "...": Renames all fields to use a different case. Available cases are:"lowercase""UPPERCASE""PascalCase""camelCase""snake_case""SCREAMING_SNAKE_CASE""kebab-case""SCREAMING-KEBAB-CASE""Train-Case""Title Case"
§Implementations
The [DeserializeItem] and DeserializeValue are
implemented for the following types:
§Implementations provided
- Primitive types:
- Non-zero types:
- Atomic types:
- Miscellaneous types:
- Tuples up to size 16
PhantomData
- Collections:
- Arrays of any size
[T; N] BTreeSet<T>BTreeMap<String, T>BinaryHeap<T>LinkedList<T>Vec<T>VecDeque<T>HashSet<T>HashMap<String, T>NonEmpty<T>since we use it in the public API
- Arrays of any size
- Network types:
- Strings:
- Unprocessed types:
Additionally, we provide Spanned<T> which allows you to wrap any type that can be deserialized from TOML
to obtain its SourceSpan that represents the location of the type in the TOML
file itself - to use as you please.
Re-exports§
Modules§
Structs§
- Deserialize
Errors - Potentially recoverable errors that occured while deserializing the TOML
- Spanned
- Capture a value’s span in the TOML source file
Enums§
- Key
- The
Keyin aKey <=> Valuepair
Traits§
- Deserialize
Table - Types that can be deserialized from a [
toml_edit::Table] - Deserialize
Value - Types that can be deserialized from a [
toml_edit::Value] - Error
- Represents a single error encountered during deserialization
Type Aliases§
- Value
- Value