Expand description
Well-known formatting hints.
Hints tell formats how a value would like to be presented. They are not part of the data model and never change the value: formats which do not have a choice (or do not support a hint) ignore them. Hints are event data which is attached to the first event of a value. They are set by values (for instance through the adapters of this module) or by layers, which allows to set them by path. The last hint set wins, so hints set by layers take precedence over the ones of the values.
| Hint | Honored by |
|---|---|
Layout | TOML (inline tables and arrays of tables), YAML (flow style), JSON and XML (single line when indented) |
Formats can define their own hints and adapters for them with Hint
and Hinted.
use std::collections::BTreeMap;
use deser::Serialize;
use deser::hints::Compact;
#[derive(Serialize)]
struct Config {
#[deser(as = Compact)]
point: BTreeMap<String, u32>,
}Structs§
- Compact
Layout - The
HintforLayout::Compact. - Expanded
Layout - The
HintforLayout::Expanded. - Hinted
- An adapter which sets a
Hintand serializes the value with another adapter.
Enums§
- Layout
- How a map or sequence is laid out by formats that have a choice.
Traits§
Type Aliases§
- Compact
- Serializes a value with
Layout::Compact. - Expanded
- Serializes a value with
Layout::Expanded.