Skip to main content

Row

Derive Macro Row 

Source
#[derive(Row)]
{
    // Attributes available to this derive:
    #[row]
}
Expand description

Derive Row: a plain struct as the type of the entities a surface publishes that live outside any document — processes, devices, containers, journal entries, a fetched catalogue’s rows. See tilo_resource::words.

#[row(kind = "app.thing", label = "Thing")] names what a row of it is to search, exactly as a #[resource] type’s items say theirs; label defaults to the type’s name in words. effects = Type names the vocabulary offered on every row of the type (#[effect(on = Thing)]), each bound to the row’s id; LiveRow::typed publishes them, so a press on the row is one of the type’s effects or open. Generates impl tilo_resource::words::RowType.

How a row’s effects take their arguments: the first parameter is the row id, parsed as that field’s type (String, u64, an identity), and a row whose id is not one is published unavailable with the reason. LiveRow::labelled names one effect for that row alone; RowBindings with LiveRow::typed_with offers only the effects the row’s state says apply, binding further arguments by name (operation, folder) or the row id itself; LiveRow::prefilled leaves an argument asked and fills its field with the value the row knows (a calendar’s current colour, a switch’s next state). A destructive effect’s phrase is published on every spec it produces, so a row-bound invocation still asks what it loses. #[param(resource = "kind")] makes a parameter a picker of an existing resource of that kind; a parameter’s description named in the catalogue (<label key>-<param>) is read in the person’s language.