Struct ActionDecl
pub struct ActionDecl<R>where
R: Resource,{ /* private fields */ }Expand description
One mutation offered by name: a [Declaration] of the resource R,
whose fields it derefs to.
Implementations§
§impl<R> ActionDecl<R>where
R: Resource,
impl<R> ActionDecl<R>where
R: Resource,
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,
) -> ActionDecl<R>where
V: DeserializeOwned + JsonSchema,
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,
) -> ActionDecl<R>where
V: DeserializeOwned + JsonSchema,
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”).
pub fn edit(
id: &'static str,
label: impl Into<String>,
edit: Edit<R>,
) -> ActionDecl<R>
pub fn edit( id: &'static str, label: impl Into<String>, edit: Edit<R>, ) -> ActionDecl<R>
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.
pub fn new( id: &'static str, label: impl Into<String>, params: Vec<ActionParam>, build: impl Fn(&ActionArgs, i64) -> Result<<R as Resource>::Action, String> + Send + Sync + 'static, ) -> ActionDecl<R>
pub fn into_declaration(self) -> Declaration
pub fn into_declaration(self) -> Declaration
The declaration, of whichever resource.
pub fn build_action(
&self,
args: &ActionArgs,
now_ms: i64,
) -> Result<<R as Resource>::Action, String>
pub fn build_action( &self, args: &ActionArgs, now_ms: i64, ) -> Result<<R as Resource>::Action, String>
pub fn refining(self) -> ActionDecl<R>
pub fn refining(self) -> ActionDecl<R>
Mark a bound edit as refining the resource’s declared action of the
same id (bind_declaration).
pub fn tagged(self, tag: impl Into<String>) -> ActionDecl<R>
pub fn tagged(self, tag: impl Into<String>) -> ActionDecl<R>
Tag the action’s contract (ContextRequirement::Caret.tag(), an
incremental-text declaration) for the callers that read it.
pub fn describe(self, description: impl Into<String>) -> ActionDecl<R>
pub fn returns(self, result: ResultSpec) -> ActionDecl<R>
pub fn returns(self, result: ResultSpec) -> ActionDecl<R>
Declare what the action answers its caller with (an outline of the state it left), which the hosting surface supplies after it applies.
pub fn of_kind(self, kind: ActionKind) -> ActionDecl<R>
pub fn of_kind(self, kind: ActionKind) -> ActionDecl<R>
Set what the action is able to do.
pub fn below_field(self, field: &'static str) -> ActionDecl<R>
pub fn below_field(self, field: &'static str) -> ActionDecl<R>
Place the action below the one field it writes.
pub fn destructive(self) -> ActionDecl<R>
pub fn writing(self, units: Vec<String>) -> ActionDecl<R>
pub fn writing(self, units: Vec<String>) -> ActionDecl<R>
The units the action writes, as the surface lists them
([crate::footprint]).
pub fn answering(self) -> ActionDecl<R>
pub fn answering(self) -> ActionDecl<R>
Answer the caller with what the action made, from
Resource::answer.
Trait Implementations§
§impl<R> AsRef<Declaration> for ActionDecl<R>where
R: Resource,
impl<R> AsRef<Declaration> for ActionDecl<R>where
R: Resource,
§impl<R> Clone for ActionDecl<R>where
R: Resource,
impl<R> Clone for ActionDecl<R>where
R: Resource,
§fn clone(&self) -> ActionDecl<R>
fn clone(&self) -> ActionDecl<R>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl<R> Deref for ActionDecl<R>where
R: Resource,
impl<R> Deref for ActionDecl<R>where
R: Resource,
Auto Trait Implementations§
impl<R> Freeze for ActionDecl<R>
impl<R> !RefUnwindSafe for ActionDecl<R>
impl<R> Send for ActionDecl<R>
impl<R> Sync for ActionDecl<R>
impl<R> Unpin for ActionDecl<R>
impl<R> UnsafeUnpin for ActionDecl<R>
impl<R> !UnwindSafe for ActionDecl<R>
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,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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