#[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
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.
ResolveClarification
Answer a clarification with a stable key.
ApplyOperation
Compile and execute an operation when clicked (the option is the origin).
Fields
operation: OperationKeyOperation to compile through the workflow.
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: OperationKeyOperation to compile through the workflow, on the case the card belongs to.
Dismiss
Close the card without effect.
Custom
Application-defined action.
Implementations§
Source§impl StoredInteractionAction
impl StoredInteractionAction
Sourcepub fn action_class(&self) -> ActionClass
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.
Sourcepub fn declines(&self) -> bool
pub fn declines(&self) -> bool
Returns true when choosing this option ends the card without effect.
Sourcepub fn records(&self) -> Option<&OperationKey>
pub fn records(&self) -> Option<&OperationKey>
The operation a decline records, when it records one.
Trait Implementations§
Source§impl Clone for StoredInteractionAction
impl Clone for StoredInteractionAction
Source§fn clone(&self) -> StoredInteractionAction
fn clone(&self) -> StoredInteractionAction
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for StoredInteractionAction
impl Debug for StoredInteractionAction
Source§impl<'de> Deserialize<'de> for StoredInteractionAction
impl<'de> Deserialize<'de> for StoredInteractionAction
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<StoredInteractionAction, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<StoredInteractionAction, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for StoredInteractionAction
Source§impl PartialEq for StoredInteractionAction
impl PartialEq for StoredInteractionAction
Source§impl Serialize for StoredInteractionAction
impl Serialize for StoredInteractionAction
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for StoredInteractionAction
Auto Trait Implementations§
impl Freeze for StoredInteractionAction
impl RefUnwindSafe for StoredInteractionAction
impl Send for StoredInteractionAction
impl Sync for StoredInteractionAction
impl Unpin for StoredInteractionAction
impl UnsafeUnpin for StoredInteractionAction
impl UnwindSafe for StoredInteractionAction
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.