Skip to main content

Module shape

Module shape 

Source
Expand description

The stored layout of a model, as data.

Model::SHAPE describes how a value lives in the document without reading it: which keys a record has, which of them are keyed collections, what is written whole. Generic services use it to act on any record correctly — History restores a past version field by field and item by item, the way an action would have written it, instead of replacing the document wholesale.

#[derive(Model)] produces the shape of a struct from its fields; plain types are Shape::Value. A type with its own layout may declare a shape by hand, or keep the default and opt out of layout-aware services.

Structs§

FieldShape
One named field of a Shape::Record.

Enums§

Shape
How one value is laid out in the document.
Trust
Who may change a field without being asked, by what a change of it can do to the person: every API decides it from the published field edit.

Constants§

ENTRY_ORDER_KEY
The key of a collection entry’s order key.
ENTRY_VALUE_KEY
The key of a collection entry’s value.

Functions§

absent_scalar
The value an absent key of a scalar T reads as, in JSON; None for a type stored as an object or without an empty value.
stored_text
The first non-empty line of the text a T stored as value at id carries, as Model::label reads it from the value.

Type Aliases§

StoredText
Reads the first line of a field’s text from where it is stored.