Skip to main content

ActionDecl

Struct ActionDecl 

Source
pub struct ActionDecl<R: Resource> { /* private fields */ }
Expand description

One mutation offered by name: a Declaration of the resource R, whose fields it derefs to.

Implementations§

Source§

impl<R: Resource> ActionDecl<R>

Source

pub fn edit_asking<V>( id: &'static str, label: impl Into<String>, param: &'static str, description: &'static str, make: impl Fn(V) -> Edit<R> + Send + Sync + 'static, ) -> Self

A field edit whose one value its caller supplies, offered as the action id labelled label: the parameter param (described by description, typed by V’s schema) becomes the edit make(value). What a row offers when the edit is bound to it but its value is not (“Rename playlist”, “Add a song to this playlist”).

Source

pub fn edit(id: &'static str, label: impl Into<String>, edit: Edit<R>) -> Self
where Edit<R>: Send + Sync,

The field edit edit offered as the action id labelled label, its value bound: what a place or a live row offers (“Use Proton for Adobe Reader”), checked and recorded as the edit itself.

Source

pub fn new( id: &'static str, label: impl Into<String>, params: Vec<ActionParam>, build: impl Fn(&ActionArgs, i64) -> Result<R::Action, String> + Send + Sync + 'static, ) -> Self

Source

pub fn with_arguments(&self, arguments: Map<String, Value>) -> Invoke<R>

This action with arguments as a caller sent them over a call that names the action by its id: what a dispatch hands the record, which binds them as it binds any.

Source

pub fn into_declaration(self) -> Declaration

The declaration, of whichever resource.

Source

pub fn build_action( &self, args: &ActionArgs, now_ms: i64, ) -> Result<R::Action, String>

The action it builds from args at now_ms.

Source

pub fn refining(self) -> Self

Mark a bound edit as refining the resource’s declared action of the same id (bind_declaration).

Source

pub fn for_audience(self, audience: Audience) -> Self

Declare who listings offer it to (tilo_actions::Audience), as #[action(audience = ..)] declares it for a verb: a bound edit that names entries by path is for agents and scripts, not a row a person picks.

Source

pub fn tagged(self, tag: impl Into<String>) -> Self

Tag the action’s contract (ContextRequirement::Caret.tag(), an incremental-text declaration) for the callers that read it.

Source

pub fn describe(self, description: impl Into<String>) -> Self

Source

pub fn returns(self, result: ResultSpec) -> Self

Declare what the action answers its caller with (an outline of the state it left), which the hosting surface supplies after it applies.

Source

pub fn of_kind(self, kind: ActionKind) -> Self

Set what the action is able to do.

Source

pub fn below_field(self, field: &'static str) -> Self

Place the action below the one field it writes.

Source

pub fn destructive(self) -> Self

Source

pub fn writing(self, units: Vec<String>) -> Self

The units the action writes, as the surface lists them (crate::footprint).

Source

pub fn answering(self) -> Self

Answer the caller with what the action made, from Resource::answer.

Methods from Deref<Target = Declaration>§

Source

pub fn shown_label(&self) -> String

What a person reads it by now, in their language.

Source

pub fn shown_params(&self) -> Vec<ActionParam>

Its parameters, each called what the person reads it by where its catalogue has a word for it (crate::label::titled).

Trait Implementations§

Source§

impl<R: Resource> AsRef<Declaration> for ActionDecl<R>

Source§

fn as_ref(&self) -> &Declaration

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<R: Resource> Clone for ActionDecl<R>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<R: Resource> Deref for ActionDecl<R>

Source§

type Target = Declaration

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Declaration

Dereferences the value.
Source§

impl<R: Resource> DerefMut for ActionDecl<R>

Source§

fn deref_mut(&mut self) -> &mut Declaration

Mutably dereferences the value.

Auto Trait Implementations§

§

impl<R> !RefUnwindSafe for ActionDecl<R>

§

impl<R> !UnwindSafe for ActionDecl<R>

§

impl<R> Forget for ActionDecl<R>

§

impl<R> Freeze for ActionDecl<R>
where PhantomData<fn() -> R>: Freeze,

§

impl<R> Move for ActionDecl<R>

§

impl<R> Send for ActionDecl<R>
where PhantomData<fn() -> R>: Send,

§

impl<R> Sync for ActionDecl<R>
where PhantomData<fn() -> R>: Sync,

§

impl<R> Unpin for ActionDecl<R>
where PhantomData<fn() -> R>: Unpin,

§

impl<R> UnsafeUnpin for ActionDecl<R>
where PhantomData<fn() -> R>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more