Skip to main content

Module params

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§

ActionArgs
Arguments for one invocation, already checked against the action’s declared parameters.
ActionParam
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.
ParamType
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::Resource parameter takes; see ActionParam::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 a const) or owned (so an app can build one per frame from its document).