Derive Macro Effect
#[derive(Effect)]
{
// Attributes available to this derive:
#[effect]
#[param]
}
Expand description
Derive Effect: an enum’s variants become the app’s published effects —
work with no document delta, invoked by buttons, the palette, agents and
scripts alike. See tilo_resource::effect.
#[effect(operation = "app.effects")] names the vocabulary’s operation
type. Each variant is unit or has named fields (the effect’s typed
parameters, #[param("…")] describing one); its id is the variant name in
kebab case and its label the first doc line. Variant options:
#[effect(label = "...", view, row, job, cancellable, returns, destructive, privileged, idempotent, own_device, attended, audience = "agents", untrusted, opens_path, member, risk = "path", kind = "read", host_render, tag = some::TAG)]. host_render marks an effect a host
answers in a render service of its own rather than the record’s app
worker; tag (repeatable) adds a contract tag, a &'static str constant;
outside_with = "path" makes a kind = "read" effect reach outside only
when that parameter is given (an export writing the file it names).
Who may run an effect is decided by its kind, like any action. An
own_device effect’s whole scope is the invoking person’s own device,
touching nothing shared and no one else (their clipboard, their own
appearance): a room’s grants have nothing to consent to. An attended
effect needs its person attending (a chooser, a sign-in, a secret shown):
whoever acts for them is always asked first, while the person’s own click
is their decision and, like an own_device effect, needs no room’s
consent and runs only on their own device. Generates impl Effect and one ActionRef
constant per variant (Backups::RESTORE) for binding controls.