pub struct EffectDecl {Show 30 fields
pub id: &'static str,
pub label: Word,
pub keywords: &'static [&'static str],
pub icon: Option<&'static str>,
pub description: &'static str,
pub params: Vec<ActionParam>,
pub param_types: Vec<(&'static str, FieldTypeOf)>,
pub result: Option<EffectResult>,
pub kind: OperationKind,
pub prompted: bool,
pub row: bool,
pub answers: Answers,
pub risk: RiskLevel,
pub idempotent: bool,
pub action_kind: ActionKind,
pub own_device: bool,
pub attended: bool,
pub risk_of: Option<fn(&ActionArgs) -> RiskLevel>,
pub audience: Audience,
pub untrusted: bool,
pub opens: Option<&'static [&'static str]>,
pub presence: bool,
pub edits: bool,
pub member: bool,
pub items: &'static [EffectTarget],
pub row_id: Option<RowIdOf>,
pub phrase: Option<PhraseOf>,
pub offload: Option<EffectOffload>,
pub tags: &'static [&'static str],
pub outside_with: Option<&'static str>,
}Expand description
The declaration of one effect: what callers see of it.
Fields§
§id: &'static str§label: WordWhat a person reads it by, read in their language when it is published.
keywords: &'static [&'static str]The other words people use for it (keywords = "…"), comma
separated: search finds it by them as by its label.
icon: Option<&'static str>Its own picture (icon = "…"), by its Lucide name.
description: &'static str§params: Vec<ActionParam>§param_types: Vec<(&'static str, FieldTypeOf)>The surface type of each parameter whose Rust type describes one
(JsonSchema), by name: a record or enum a
parameter’s wire type (ParamType::Object)
says nothing of, which a package of another language names.
result: Option<EffectResult>The value it answers with, when the code declares one
(returns = Type); see EffectResult.
kind: OperationKindView for an effect that only changes what its caller sees, Document
for one published as a document operation the app’s own registry
applies, else Effect.
prompted: boolOffered with its first parameter’s prompt even where every parameter
may be left out (prompted).
row: boolOffered only bound to the items it acts on, not on the resource.
answers: Answers§risk: RiskLevelHow much harm invoking it can do: Destructive (deletes,
overwrites, sends) and Privileged (hands out or shows a credential)
ask for confirmation; a view is None.
idempotent: boolSafe to repeat after an uncertain outcome.
action_kind: ActionKindWhat it is able to do: reach outside the record by default, read for
a view or an effect declared kind = "read".
own_device: boolIts whole scope is the invoking person’s own device: it touches
nothing shared and no one else, so a workspace’s grants have nothing to
consent to (tilo_actions::OWN_DEVICE_SCOPE).
attended: boolNeeds its person attending: it opens a chooser, asks for a credential
or a sign-in, or shows what only they may see, so whoever acts for
them is always asked first (tilo_actions::ATTENDED_TAG).
risk_of: Option<fn(&ActionArgs) -> RiskLevel>How much harm one invocation can do, classified from its arguments (formatting the system disk, against any other): an invocation the classifier finds destructive asks for the confirmation a declared destructive effect does.
audience: AudienceWho listings offer it to (#[effect(audience = "agents")]): an agent
reading a page’s structure is never a person’s palette row.
untrusted: boolAnswers with content from outside the user’s own data (a web page’s text and logs): data to reason about, never instructions to follow.
opens: Option<&'static [&'static str]>Opens the file its path names in this instance (#[effect(opens_path)]),
of any type when empty, else of these extensions: how a caller that
launched the app with a file opens it (tilo_actions::OPENS_PATH_TAG).
presence: boolA view that changes only the invoking presence’s own view (an agent’s caret, its Find), so a remote presence may invoke it without moving anybody else’s.
edits: boolA view of the invoker that submits only edits of this record (typing at the invoker’s caret): its kind is Undoable, offered to whoever may edit, and the edits it submits are checked like any other.
member: boolAny member of a workspace may ask the workspace’s host to run it for
themselves on the workspace’s record (#[effect(member)],
tilo_actions::MEMBER_OWN_TAG): it runs there as that member.
items: &'static [EffectTarget]What the effect is offered on, its first parameter bound to it: the
collection field whose items offer it (#[effect(item = connections)],
published on each item resource as an item verb is), or the kind of a
RowType whose rows offer it
(#[effect(on = Process)], published on each of the type’s rows). An
effect declared on several of them (#[effect(on = QueueItem, on = HistoryItem)]) is offered on each, bound to the row it was offered on;
one with no parameters is offered on them as it is.
row_id: Option<RowIdOf>How a row id becomes the first parameter’s value, when the effect is
offered on rows ([EffectRow::row_id]).
phrase: Option<PhraseOf>The phrase its caller types for a bound invocation
([EffectRow::phrase]).
offload: Option<EffectOffload>A content transform the system may run on the invoker’s best-placed
device (#[effect(offload(...))]); the handler is its local run.
Further contract tags, each naming how a host treats the effect
(#[effect(host_render)], #[effect(tag = ...)]): an agent’s host
routes a tilo_actions::HOST_RENDER_TAG effect to its render
service rather than the app’s worker.
outside_with: Option<&'static str>The parameter that, given, makes an invocation reach outside the
record (#[effect(kind = "read", outside_with = "path")]): an export
writing the file it names. Without it the invocation only reads and
keeps what it made as content, and is admitted as a read.
Implementations§
Source§impl EffectDecl
impl EffectDecl
Sourcepub fn spec<E: Effect>(&self, operation: &'static str) -> ActionSpec
pub fn spec<E: Effect>(&self, operation: &'static str) -> ActionSpec
The published action of this effect under operation, of the
vocabulary E it is declared in.
An effect whose fields are all optional runs when a person chooses
it, asked nothing: a field left out is None, which the effect gives
a meaning (“About”’s open left out switches the sheet). Asking
instead put the first field’s help text in the search field. One
that takes an entry or content still asks for it.
Sourcepub fn spec_of<E: Effect>(&self) -> ActionSpec
pub fn spec_of<E: Effect>(&self) -> ActionSpec
The published action of this effect, as the vocabulary E that
declares it publishes it: Self::spec under E’s own operation.
pub fn of_row(row: &EffectRow) -> Self
Sourcepub fn action_kind(&self) -> ActionKind
pub fn action_kind(&self) -> ActionKind
The published action of this effect, taking params and encoding
an invocation with build.
What kind of action the effect is: a view reads, anything else
reaches outside the document.
Trait Implementations§
Source§impl Clone for EffectDecl
impl Clone for EffectDecl
Auto Trait Implementations§
impl Forget for EffectDecl
impl Freeze for EffectDecl
impl Move for EffectDecl
impl RefUnwindSafe for EffectDecl
impl Send for EffectDecl
impl Sync for EffectDecl
impl Unpin for EffectDecl
impl UnsafeUnpin for EffectDecl
impl UnwindSafe for EffectDecl
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more