Skip to main content

Module with

Module with 

Source
Expand description

Field codecs: #[data(with = "…")] reads and writes a field through a type other than its own — like serde’s with. The field keeps the plain type a program uses (String), the format says what it holds (an item reference, a text), checked and resolved by the Reader’s Resolve.

ⓘ
#[derive(Schema)]
struct Spotlight {
    /// `@item:` or `@block:`, kept as the plain id.
    #[data(with = "RefTo<(kinds::Item, kinds::Block)>")]
    item: String,
    /// A text, a `.yres` text or a name, kept resolved.
    #[data(with = "Opt<TextOf>")]
    text: Option<String>,
}

Structs§

List
A list, each item through W.
Opt
An optional field through W.
Plain
The field’s own schema — with spelled out (List<Plain> for a Vec<T: Schema>).
RefTo
A reference to content of kind(s) K, kept as the resolved id.
TextOf
A text (Text: written, a .yres text, or a name), kept resolved.
Values
An object of any keys, each value through W.

Traits§

With
How a field of type F is read and written.