Skip to main content

InteractionRequirement

Struct InteractionRequirement 

Source
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: String

Stable key per phase (e.g. "send_confirmation").

§kind: InteractionKind

Shape of the interaction.

§blocking: bool

Whether it owns unqualified answers for the case (I5).

§revision_independent: bool

Whether a revision change leaves it valid.

§text_resolution: TextResolutionPolicy

Whether typed text may resolve it.

§confirms_risk: RiskClass

Highest 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

Source

pub fn blocking(key: impl Into<String>, kind: InteractionKind) -> Self

A blocking, revision-bound requirement with Never text resolution.

Source

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.

Source

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).

Source

pub fn with_payload(self, payload: InteractionPayload) -> Self

Attaches a full payload.

Source

pub fn with_text_resolution(self, policy: TextResolutionPolicy) -> Self

Sets the text resolution policy.

Source

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

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

Source§

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

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

impl<'de> Deserialize<'de> for InteractionRequirement

Source§

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

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

impl Eq for InteractionRequirement

Source§

impl PartialEq for InteractionRequirement

Source§

fn eq(&self, other: &Self) -> 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 InteractionRequirement

Source§

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

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

impl StructuralPartialEq for InteractionRequirement

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, 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.