#[non_exhaustive]pub struct ClaimWorkflow;Expand description
The receipt-claim workflow.
Implementations§
Source§impl ClaimWorkflow
impl ClaimWorkflow
Sourcepub fn phase_of(state: &ClaimState) -> ClaimPhase
pub fn phase_of(state: &ClaimState) -> ClaimPhase
The phase a state projects to.
Trait Implementations§
Source§impl Clone for ClaimWorkflow
impl Clone for ClaimWorkflow
impl Copy for ClaimWorkflow
Source§impl Debug for ClaimWorkflow
impl Debug for ClaimWorkflow
Source§impl Default for ClaimWorkflow
impl Default for ClaimWorkflow
Source§impl PureWorkflow for ClaimWorkflow
impl PureWorkflow for ClaimWorkflow
Source§fn apply(
&self,
state: Option<&ClaimState>,
command: &ClaimCommand,
) -> Result<Applied<ClaimState, ClaimEvent>, DomainRejection>
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
fn event_type(&self, event: &ClaimEvent) -> String
Stable event type label of an event, e.g.
"trip.extra_added".Source§impl WorkflowDefinition for ClaimWorkflow
impl WorkflowDefinition for ClaimWorkflow
Source§fn build_interaction(
&self,
state: Option<&ClaimState>,
view: &ViewOf<Self>,
requirement: &InteractionRequirement,
) -> Result<InteractionSpec, DomainRejection>
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
type State = ClaimState
Persisted case state.
Source§type Phase = ClaimPhase
type Phase = ClaimPhase
Lifecycle phase.
Source§type Obligation = ClaimObligation
type Obligation = ClaimObligation
Open obligation, possibly parameterized.
Source§type Command = ClaimCommand
type Command = ClaimCommand
Typed command.
Source§type Event = ClaimEvent
type Event = ClaimEvent
Typed domain event.
Source§type Outcome = ClaimOutcome
type Outcome = ClaimOutcome
Terminal outcome.
Source§fn key(&self) -> WorkflowKey
fn key(&self) -> WorkflowKey
Stable key.
Source§fn version(&self) -> WorkflowVersion
fn version(&self) -> WorkflowVersion
Version; must change when projection semantics change (spec §8.4).
Source§fn phase_ownership(&self, phase: &ClaimPhase) -> PhaseOwnership
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>
fn project(&self, case_ref: CaseRef, state: Option<&ClaimState>) -> ViewOf<Self>
Pure projection (I2). Read more
Source§fn summary(&self) -> Option<String>
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>
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>
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>
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
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>
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>
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>
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>
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>
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 moreSource§fn obligation_sentence(
&self,
obligation: &Self::Obligation,
) -> Option<LocalizedText>
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>
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 moreSource§fn start_preconditions(&self) -> Vec<StartPrecondition>
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>
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
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>
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 moreSource§fn transition_briefing(
&self,
view: &WorkflowView<Self::Phase, Self::Obligation, Self::Outcome>,
) -> Option<String>
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>
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>
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>
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>
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>
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
impl WorkflowModel<ClaimWorkflow> for ClaimModel
Source§fn initial_states(&self) -> Vec<Option<ClaimState>>
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>
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>
fn simulate( &self, state: Option<&ClaimState>, command: &ClaimCommand, ) -> SimulatedTransition<ClaimState, ClaimEvent>
Applies one candidate command purely.
Source§fn declared_outcomes(&self) -> Vec<ClaimOutcome>
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§
impl Freeze for ClaimWorkflow
impl RefUnwindSafe for ClaimWorkflow
impl Send for ClaimWorkflow
impl Sync for ClaimWorkflow
impl Unpin for ClaimWorkflow
impl UnsafeUnpin for ClaimWorkflow
impl UnwindSafe for ClaimWorkflow
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
Mutably borrows from an owned value. Read more