pub struct InteractionSpec {
pub key: String,
pub case_ref: CaseRef,
pub kind: InteractionKind,
pub blocking: bool,
pub payload: InteractionPayload,
pub expires_in: Option<Duration>,
pub text_resolution: TextResolutionPolicy,
pub confirms_risk: RiskClass,
pub binds_to_revision: bool,
}Expand description
What a reducer or workflow asks the engine to create (spec §13.3, I6).
Fields§
§key: StringStable key within a turn/plan (e.g. "select_target:acts[1]"). Two
specs with the same key describe the same interaction.
case_ref: CaseRefCase the interaction belongs to; its revision is the bound revision.
kind: InteractionKindShape.
blocking: boolWhether it owns unqualified answers for the case (I5).
payload: InteractionPayloadContent.
expires_in: Option<Duration>Time to live, if any.
text_resolution: TextResolutionPolicyWhether typed text may resolve it.
confirms_risk: RiskClassHighest risk class of the commands an answer to this card authorizes.
The default is RiskClass::Irreversible, so a card that forgets to
declare it is treated as consequential and can never be resolved from
typed text (spec §13.2 rule 8, §15.7).
binds_to_revision: booltrue when the interaction is invalidated by a case revision change.
Implementations§
Source§impl InteractionSpec
impl InteractionSpec
Sourcepub fn new(
key: impl Into<String>,
case_ref: CaseRef,
kind: InteractionKind,
payload: InteractionPayload,
) -> InteractionSpec
pub fn new( key: impl Into<String>, case_ref: CaseRef, kind: InteractionKind, payload: InteractionPayload, ) -> InteractionSpec
Builds a blocking, revision-bound spec with Never text resolution and
the conservative RiskClass::Irreversible confirmation risk.
Sourcepub fn with_confirms_risk(self, risk: RiskClass) -> InteractionSpec
pub fn with_confirms_risk(self, risk: RiskClass) -> InteractionSpec
Declares the highest risk class an answer authorizes.
Sourcepub fn validate(&self) -> Result<(), InteractionSpecError>
pub fn validate(&self) -> Result<(), InteractionSpecError>
Checks that the card can be answered and that its text-resolution policy is allowed for what it confirms.
Beyond InteractionPayload::validate_for, any policy other than
TextResolutionPolicy::Never is refused when the card authorizes
commands above RiskClass::ReversibleLowRisk or is one of the
authorizing kinds (InteractionKind::authorizes_commands): a
confirmation inferred from prose is not a confirmation.
Sourcepub fn non_blocking(self) -> InteractionSpec
pub fn non_blocking(self) -> InteractionSpec
Marks the spec non-blocking.
Sourcepub fn with_text_resolution(
self,
policy: TextResolutionPolicy,
) -> InteractionSpec
pub fn with_text_resolution( self, policy: TextResolutionPolicy, ) -> InteractionSpec
Sets the text resolution policy.
Sourcepub fn expires_in(self, ttl: Duration) -> InteractionSpec
pub fn expires_in(self, ttl: Duration) -> InteractionSpec
Sets the time to live.
Sourcepub fn revision_independent(self) -> InteractionSpec
pub fn revision_independent(self) -> InteractionSpec
Makes the interaction survive revision changes.
Trait Implementations§
Source§impl Clone for InteractionSpec
impl Clone for InteractionSpec
Source§fn clone(&self) -> InteractionSpec
fn clone(&self) -> InteractionSpec
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 InteractionSpec
impl Debug for InteractionSpec
Source§impl<'de> Deserialize<'de> for InteractionSpec
impl<'de> Deserialize<'de> for InteractionSpec
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<InteractionSpec, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<InteractionSpec, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for InteractionSpec
Source§impl PartialEq for InteractionSpec
impl PartialEq for InteractionSpec
Source§impl Serialize for InteractionSpec
impl Serialize for InteractionSpec
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 InteractionSpec
Auto Trait Implementations§
impl Freeze for InteractionSpec
impl RefUnwindSafe for InteractionSpec
impl Send for InteractionSpec
impl Sync for InteractionSpec
impl Unpin for InteractionSpec
impl UnsafeUnpin for InteractionSpec
impl UnwindSafe for InteractionSpec
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.