Crate oh_my_toml

Crate oh_my_toml 

Source
Expand description

This crate contains the [OhMyToml] derive macro

§Attributes

§Field attributes

  • default or default = value: If the field is missing then the default value for the field will be used
  • on_default = "error": If the default value 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: Applies default to each field
    • To opt-out for a single field, use require
  • on_default_all = "error": Applies on_default = "error" to each field
    • To opt-out for a single field, use on_default = "ok" on the field
  • 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

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§

pub use miette;
pub use nonempty;
pub use strsim;
pub use thiserror;
pub use toml;

Modules§

error
Built-in deserialization errors for specific types
util
Utilities

Structs§

DeserializeErrors
Potentially recoverable errors that occured while deserializing the TOML
Spanned
Capture a value’s span in the TOML source file

Enums§

Key
The Key in a Key <=> Value pair

Traits§

DeserializeTable
Types that can be deserialized from a [toml_edit::Table]
DeserializeValue
Types that can be deserialized from a [toml_edit::Value]
Error
Represents a single error encountered during deserialization

Type Aliases§

Value
Value