pub struct InteractionRequirement {
pub key: String,
pub kind: InteractionKind,
pub blocking: bool,
pub revision_independent: bool,
pub text_resolution: TextResolutionPolicy,
pub confirms_risk: RiskClass,
pub expires_in: Option<Duration>,
pub payload: Option<InteractionPayload>,
}Expand description
What a user-owned phase requires from the user (I6).
The requirement is data; the workflow turns it into a full
InteractionSpec through WorkflowDefinition::build_interaction, where
it can consult state. When the projection can already describe the whole
card, it may set payload and rely on the default implementation.
Fields§
§key: StringStable key per phase (e.g. "send_confirmation").
kind: InteractionKindShape of the interaction.
blocking: boolWhether it owns unqualified answers for the case (I5).
revision_independent: boolWhether a revision change leaves it valid.
text_resolution: TextResolutionPolicyWhether typed text may resolve it.
confirms_risk: RiskClassHighest risk class an answer to this card authorizes. Conservative by default, so a requirement that forgets it cannot be resolved from text.
expires_in: Option<Duration>Time to live.
payload: Option<InteractionPayload>Full payload when the projection can describe it.
Implementations§
Source§impl InteractionRequirement
impl InteractionRequirement
Sourcepub fn blocking(key: impl Into<String>, kind: InteractionKind) -> Self
pub fn blocking(key: impl Into<String>, kind: InteractionKind) -> Self
A blocking, revision-bound requirement with Never text resolution.
Sourcepub fn non_blocking(key: impl Into<String>, kind: InteractionKind) -> Self
pub fn non_blocking(key: impl Into<String>, kind: InteractionKind) -> Self
A non-blocking requirement: a card the case offers without owning the answers to everything else.
The flag existed and could not be set, which made every declared card blocking whether or not the question wanted one. A blocking card owns unqualified answers for the whole case (I5), so putting one beside a question whose ordinary answer is a value leaves the user reading buttons that cannot say what they came to say.
The other half of that problem is answered by the claim the act declares, which lets the refusal be spoken instead of pressed. This is the smaller lever, kept because a field nobody can write is not a field.
Sourcepub fn with_confirms_risk(self, risk: RiskClass) -> Self
pub fn with_confirms_risk(self, risk: RiskClass) -> Self
Declares the highest risk class an answer authorizes. Lowering it is what makes a card resolvable from typed text (spec §15.7).
Sourcepub fn with_payload(self, payload: InteractionPayload) -> Self
pub fn with_payload(self, payload: InteractionPayload) -> Self
Attaches a full payload.
Sourcepub fn with_text_resolution(self, policy: TextResolutionPolicy) -> Self
pub fn with_text_resolution(self, policy: TextResolutionPolicy) -> Self
Sets the text resolution policy.
Sourcepub fn to_spec(&self, case_ref: CaseRef) -> InteractionSpec
pub fn to_spec(&self, case_ref: CaseRef) -> InteractionSpec
Builds a spec for case_ref, using payload or a title-only payload
named after the key.
A title-only payload is answerable for no kind, so a requirement without
a payload must be completed by
WorkflowDefinition::build_interaction; the spec is validated there.
Trait Implementations§
Source§impl Clone for InteractionRequirement
impl Clone for InteractionRequirement
Source§impl Debug for InteractionRequirement
impl Debug for InteractionRequirement
Source§impl<'de> Deserialize<'de> for InteractionRequirement
impl<'de> Deserialize<'de> for InteractionRequirement
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for InteractionRequirement
Source§impl PartialEq for InteractionRequirement
impl PartialEq for InteractionRequirement
Source§impl Serialize for InteractionRequirement
impl Serialize for InteractionRequirement
impl StructuralPartialEq for InteractionRequirement
Auto Trait Implementations§
impl Freeze for InteractionRequirement
impl RefUnwindSafe for InteractionRequirement
impl Send for InteractionRequirement
impl Sync for InteractionRequirement
impl Unpin for InteractionRequirement
impl UnsafeUnpin for InteractionRequirement
impl UnwindSafe for InteractionRequirement
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.