Module params
Expand description
Typed action parameters: what an invocation must carry, and the strict bind that checks it before anything runs.
An ActionSpec used to describe its argument
in prose — "Value 0–1", "Rate, e.g. 0.5 / 1 / 2", "grayscale / sepia / invert" — and hand the raw string to a closure that parsed it leniently. A
typo became a silent default. That is tolerable when a human is looking at a
prompt and can see the result; it is not tolerable for a caller with no
screen, whose only description of the surface is the enumeration it was
handed.
So a parameter is declared, not narrated: a name, a
ParamType, whether it is required, optional
choices, and a description that explains meaning
rather than syntax. ActionArgs::bind then refuses a missing, unknown,
wrong-typed or out-of-choice argument up front, so a bad call is a refusal
and never a half-applied edit.
§One vocabulary, both sides
This is deliberately the same vocabulary the compositor’s headless action
API already speaks (ParamType / ActionParam / ArgValue / strict
ActionArgs::bind), lifted here so the app-side action model and the
shell-side one share a single definition instead of converging by accident.
The const constructors keep const PARAMS: &[ActionParam] = &[…]
compiling verbatim; the owned constructors are what an app needs, because an
app builds its parameters at runtime out of document state.
Structs§
- Action
Args - Arguments for one invocation, already checked against the action’s declared parameters.
- Action
Param - One typed parameter an action declares.
Enums§
- ArgError
- Why a set of arguments does not satisfy an action’s parameters.
- ArgValue
- One bound argument value.
- Param
Type - The type of one action parameter. Deliberately small: these are values a caller with no screen can produce from a descriptor alone.
Constants§
- ARGUMENTS_
JSON_ PREFIX - Marks the legacy single-string invocation slot as carrying a canonical JSON argument object. The record-separator prefix cannot be produced by a normal palette text field, preserving unambiguous backward compatibility.
- CONTENT_
ANNOTATION - Schema annotation marking a text parameter as the address of content
another action produced (a content hash), not words a caller can say;
see
ActionParam::as_content. - PLACE_
ANNOTATION - Schema annotation marking a parameter as a place inside the resource the
action is on (an item, a caret in it, a range of it); see
ActionParam::as_place. - RESOURCE_
KIND_ ANNOTATION - Schema annotation naming the kind of resource a
ParamType::Resourceparameter takes; seeActionParam::of_resource_kind. An annotation, not an assertion: binding does not check it.
Functions§
- place_
schema - The schema of a place inside a resource (
ActionParam::as_place). - validate_
json_ schema - Validate one JSON value against the deterministic JSON Schema subset used by Tilo action contracts.
Type Aliases§
- Str
- A string that is either a
&'static str(so a parameter list can be aconst) or owned (so an app can build one per frame from its document).