Expand description
§Eon: the human-friendly configuration format
Eon is a configuration format that is designed to be familiar, clean, and powerful.
Example Eon document:
// Comment
string: "Hello Eon!"
list: [1, 2, 3]
object: {
boolean: true
regex: '\d{3}-\d{3}-\d{4}'
}
map: {
1: "map keys don't need to be strings"
2: "they can be any Eon value"
}
special_floats: [+inf, -inf, +nan]Read more about Eon at https://github.com/emilk/eon.
§Usage with serde
Make sure to enable the serde feature for eon in your Cargo.toml (it’s currently enabled by default):
[dependencies]
eon = { version = "*", features = ["serde"] }Deserialize any value that implements serde::Deserialize using from_str.
Serialize any value that implements serde::Serialize into Eon using to_string
§Usage with Value
You can also treat an Eon document as a dynamically types Value.
Load an Eon document into a Value using Value::from_str.
Serialize a Value into an Eon string using Value::format.
You can also convert anything that implements serde::Serialize into a Value using to_value,
§Reading/writing comments
An Eon document can contain comments, which are NOT part of the Value type.
To load and serialize comments, use the low-level eon_syntax crate instead.
§Formatting Eon files
Use reformat to format an Eon file.
You can also use the eonfmt CLI tool.
§Feature flags
serde(enabled by default) — Enable serializing/deserializing Eon values withserde.
Modules§
- external
- External crates used by
eon.
Structs§
- Format
Options - How to format an Eon document.
- Map
- Maps values to values.
- Number
- Represents a number (float, integer, …)
- Serialization
Error - An error during serde-serialization into Eon.
- Variant
- A sum-type (enum) variant containing some data, like
"Rgb"(255, 0, 0).
Enums§
Functions§
- from_
str - Parse an Eon value from a string into a type
Tthat implementsserde::de::DeserializeOwned. - reformat
- Parses an Eon file and re-indents and formats it in a pretty way.
- to_
string - Serialize a value (using serde) into an Eon string.
- to_
value - Serialize a value (using serde) into a
Value.