Skip to main content

ClaimWorkflow

Struct ClaimWorkflow 

Source
#[non_exhaustive]
pub struct ClaimWorkflow;
Expand description

The receipt-claim workflow.

Implementations§

Source§

impl ClaimWorkflow

Source

pub const fn new() -> Self

Builds the workflow.

Source

pub fn phase_of(state: &ClaimState) -> ClaimPhase

The phase a state projects to.

Trait Implementations§

Source§

impl Clone for ClaimWorkflow

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 Copy for ClaimWorkflow

Source§

impl Debug for ClaimWorkflow

Source§

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

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

impl Default for ClaimWorkflow

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PureWorkflow for ClaimWorkflow

Source§

fn apply( &self, state: Option<&ClaimState>, command: &ClaimCommand, ) -> Result<Applied<ClaimState, ClaimEvent>, DomainRejection>

Applies one command to one state, refusing it the way the real domain would. Must be deterministic and must not mutate state.
Source§

fn event_type(&self, event: &ClaimEvent) -> String

Stable event type label of an event, e.g. "trip.extra_added".
Source§

impl WorkflowDefinition for ClaimWorkflow

Source§

fn build_interaction( &self, state: Option<&ClaimState>, view: &ViewOf<Self>, requirement: &InteractionRequirement, ) -> Result<InteractionSpec, DomainRejection>

Binds the card to the proposal, not to the whole state.

The trip sample puts a digest of the entire case in its rebooking card’s metadata, because the entire case is what that card is about. This card is about the proposal, so the proposal is what it hashes — and the case revision is deliberately not in the metadata, because revision binding is already the interaction’s own mechanism and putting it in the payload would make the payload hash change for every unrelated edit.

Source§

type State = ClaimState

Persisted case state.
Source§

type Phase = ClaimPhase

Lifecycle phase.
Source§

type Obligation = ClaimObligation

Open obligation, possibly parameterized.
Source§

type Command = ClaimCommand

Typed command.
Source§

type Event = ClaimEvent

Typed domain event.
Source§

type Outcome = ClaimOutcome

Terminal outcome.
Source§

fn key(&self) -> WorkflowKey

Stable key.
Source§

fn version(&self) -> WorkflowVersion

Version; must change when projection semantics change (spec §8.4).
Source§

fn phase_ownership(&self, phase: &ClaimPhase) -> PhaseOwnership

Who must act in a phase. Drives the §8.4 invariants.
Source§

fn project(&self, case_ref: CaseRef, state: Option<&ClaimState>) -> ViewOf<Self>

Pure projection (I2). Read more
Source§

fn summary(&self) -> Option<String>

One line saying what the workflow is for, shown when a message is split into requests. None, the default, shows the workflow’s key alone.
Source§

fn noun(&self) -> Option<LocalizedText>

What one record of this workflow is called, in each language its users speak («traveler», «viaggiatore»), for the sentences the runtime writes about one. None, the default, uses the workflow’s key.
Source§

fn operations(&self, view: &ViewOf<Self>) -> Vec<OperationSpec>

The operations offered in this view, with their arguments, labels and examples.
Source§

fn compile_act( &self, _state: Option<&ClaimState>, _view: &ViewOf<Self>, act: &ResolvedAct, ) -> Result<Vec<ClaimCommand>, DomainRejection>

Compiles a resolved act into typed commands (spec §21.2).
Source§

fn command_policy( &self, _state: Option<&ClaimState>, command: &ClaimCommand, ) -> CommandPolicy

Policy of a command. Unknown commands must default to CommandPolicy::conservative.
Source§

fn validate_command( &self, state: Option<&ClaimState>, command: &ClaimCommand, ) -> Result<(), DomainRejection>

Deterministic validation before execution.
Source§

fn receipts( &self, events: &[ReceiptEvent<ClaimEvent>], locale: &Locale, ) -> Vec<OperationalReceipt>

Renders receipts from committed events (spec §17.3). Read more
Source§

fn narratable_state(&self, state: Option<&Self::State>) -> Vec<StateField>

What this case HOLDS, for the stage that answers questions. Read more
Source§

fn glossary(&self) -> Vec<GlossaryTerm>

Terms this workflow’s users say, and what they mean here.
Source§

fn briefing( &self, view: &WorkflowView<Self::Phase, Self::Obligation, Self::Outcome>, ) -> Option<String>

Guidance for understanding a turn about a record in this view. None, the default, is ordinary. Read more
Source§

fn obligation_sentence( &self, obligation: &Self::Obligation, ) -> Option<LocalizedText>

One obligation, in words a person would recognise. Read more
Source§

fn obligation_act( &self, state: Option<&Self::State>, obligation: &Self::Obligation, ) -> Option<ObligationAct>

The act that answers obligation, and the values it already knows. Read more
Source§

fn start_preconditions(&self) -> Vec<StartPrecondition>

What must already be true of another case before this workflow may be started. Read more
Source§

fn confirmation_subject( &self, state: Option<&Self::State>, view: &WorkflowView<Self::Phase, Self::Obligation, Self::Outcome>, act: &ResolvedAct, ) -> Option<ConfirmationSubject>

What a confirmation the policy engine raises is about. Read more
Source§

fn start_behaviour(&self) -> StartBehaviour

What starting this workflow means when a case of it is already open. Read more
Source§

fn may_open_beside( &self, open: &[WorkflowView<Self::Phase, Self::Obligation, Self::Outcome>], ) -> Result<(), DomainRejection>

Whether a new case may be opened while open ones are: an operation aimed at a new record, the door StartBehaviour does not govern. Read more
Source§

fn transition_briefing( &self, view: &WorkflowView<Self::Phase, Self::Obligation, Self::Outcome>, ) -> Option<String>

What this workflow wants said while it acknowledges the turn and asks for what is still open. Read more
Source§

fn answer_briefing( &self, view: &WorkflowView<Self::Phase, Self::Obligation, Self::Outcome>, ) -> Option<String>

What this workflow wants said while it answers a question the user asked. Read more
Source§

fn enumerations( &self, view: &WorkflowView<Self::Phase, Self::Obligation, Self::Outcome>, ) -> Vec<DomainEnumeration>

The complete sets of values this workflow accepts, for the fields where there is one. Read more
Source§

fn next_steps( &self, view: &WorkflowView<Self::Phase, Self::Obligation, Self::Outcome>, ) -> Vec<LocalizedText>

What the user may do next once the case owes nothing, each a sentence in the workflow’s words: the reply offers them when the case needs nothing more. Read more
Source§

fn artifacts( &self, view: &WorkflowView<Self::Phase, Self::Obligation, Self::Outcome>, ) -> Vec<ArtifactRef>

The documents this case has, for the turn to put in front of the user. Read more
Source§

fn nothing_changed( &self, state: Option<&Self::State>, act: &ResolvedAct, ) -> Option<LocalizedText>

Why an act that compiled nothing changed nothing, in the reader’s own words. Read more
Source§

impl WorkflowModel<ClaimWorkflow> for ClaimModel

Source§

fn initial_states(&self) -> Vec<Option<ClaimState>>

The states exploration starts from. None means “the case does not exist yet”, which is where most workflows begin — and it never means “the case is over”, because a case’s identity outlives its content.
Source§

fn candidate_commands(&self, state: Option<&ClaimState>) -> Vec<ClaimCommand>

Commands worth trying in this state, in a stable order. Include commands you expect to be refused: the explorer checks that a refusal changes nothing.
Source§

fn simulate( &self, state: Option<&ClaimState>, command: &ClaimCommand, ) -> SimulatedTransition<ClaimState, ClaimEvent>

Applies one candidate command purely.
Source§

fn declared_outcomes(&self) -> Vec<ClaimOutcome>

Outcomes the workflow claims it can reach. The explorer reports every declared outcome no reachable state projects. The default is empty, which disables the check.

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> AsOut<T> for T
where T: Copy,

Source§

fn as_out(&mut self) -> Out<'_, T>

Returns an out reference to self.
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> DynClone for T
where T: Clone,

Source§

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

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