Skip to main content

StoredInteractionAction

Enum StoredInteractionAction 

Source
#[non_exhaustive]
pub enum StoredInteractionAction { ConfirmCommands { command_refs: Vec<CommandRef>, }, DeclineCommands, SelectTarget { case_ref: CaseRef, }, ResolveClarification { answer_key: String, }, ApplyOperation { operation: OperationKey, arguments: Value, freeform_argument: Option<String>, }, DeclineAndRecord { operation: OperationKey, }, Dismiss, Custom { key: String, payload: Value, }, }
Expand description

The server-side meaning of an option (spec §15.3). Never supplied by the client.

Applications add meanings through Self::Custom and the library adds variants, so downstream matches need a wildcard arm.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

ConfirmCommands

Execute commands that were compiled and journaled when the card was made.

Fields

§command_refs: Vec<CommandRef>

The commands.

§

DeclineCommands

Drop the pending commands.

§

SelectTarget

Bind an ambiguous act to this case.

Fields

§case_ref: CaseRef

The chosen case.

§

ResolveClarification

Answer a clarification with a stable key.

Fields

§answer_key: String

Application-defined answer key.

§

ApplyOperation

Compile and execute an operation when clicked (the option is the origin).

Fields

§operation: OperationKey

Operation to compile through the workflow.

§arguments: Value

Arguments for the operation.

§freeform_argument: Option<String>

Where the option’s free text goes in those arguments, as a JSON pointer (RFC 6901), for a card that asks for a VALUE rather than a choice.

None is every card that only offers options, which is all of them until one asks a question whose answer is a word.

§Why a card at all, when the user could just type

Because a question in prose is not a state: the next message arrives as free text, and what to do with it is a guess among every operation that accepts a name. Asked on a card, the question is the state: the answer arrives bound to the case and to the operation, and nothing is chosen.

A JSON pointer into the operation’s arguments.

§

DeclineAndRecord

Drop the pending commands, and record that the card was answered.

§The trace a “no” could not leave

A confirmation must carry an option that declines, and both declining actions end the card without effect. So the only shape a “no” could take wrote nothing — and a workflow whose next sentence depends on whether the user has already answered could not tell that they had.

A send confirmation offered “Send” and “Edit”. The user pressed Edit; nothing was written, so the projection was unchanged, so the phase’s own instruction to the writing stage was served again, and the reply was word for word the sentence the user had just answered. The writer was obeying.

The runtime already remembers the answer well enough not to raise the card again, and that memory decides whether the card is rendered. It does not reach what the workflow tells the stage that speaks, which is where the repetition lives.

§What it is not

It does not run what it declined. The journaled commands are dropped exactly as Self::DeclineCommands drops them, Self::declines is true of it, and it satisfies the requirement that a confirmation offer a way to say no. What it adds is one operation, named by the server that wrote the card, compiled through compile_act and validated like any other — so a workflow that records nothing is unaffected, and one that records something cannot smuggle a confirmation through this door, because no pending command executes on it.

The operation is the domain’s bookkeeping, so its command_policy had better not ask for a confirmation of its own.

Fields

§operation: OperationKey

Operation to compile through the workflow, on the case the card belongs to.

§

Dismiss

Close the card without effect.

§

Custom

Application-defined action.

Fields

§key: String

Application key.

§payload: Value

Application payload.

Implementations§

Source§

impl StoredInteractionAction

Source

pub fn action_class(&self) -> ActionClass

What choosing this option authorizes.

Self::Custom is deliberately ActionClass::NoCommands: an application-defined action cannot be a confirmation, because the library cannot know what it does.

Source

pub fn declines(&self) -> bool

Returns true when choosing this option ends the card without effect.

Source

pub fn records(&self) -> Option<&OperationKey>

The operation a decline records, when it records one.

Trait Implementations§

Source§

impl Clone for StoredInteractionAction

Source§

fn clone(&self) -> StoredInteractionAction

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 Debug for StoredInteractionAction

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for StoredInteractionAction

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<StoredInteractionAction, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for StoredInteractionAction

Source§

impl PartialEq for StoredInteractionAction

Source§

fn eq(&self, other: &StoredInteractionAction) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for StoredInteractionAction

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for StoredInteractionAction

Auto Trait Implementations§

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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