pub struct WorkflowView<P, O, T> {
pub case_ref: CaseRef,
pub workflow_version: WorkflowVersion,
pub phase: P,
pub obligations: Vec<O>,
pub blocking_interaction: Option<InteractionRequirement>,
pub notices: Vec<WorkflowNotice>,
pub outcome: Option<T>,
}Expand description
The pure projection of a case (spec §8.1).
Fields§
§case_ref: CaseRefThe case and the revision it was projected at.
workflow_version: WorkflowVersionVersion of the definition that produced the view.
phase: PExactly one lifecycle phase (I3).
obligations: Vec<O>Every currently open obligation, possibly parameterized (I4), in the order the workflow wants them asked for.
A set is the truth about what is open and is what an index wants; it cannot say which one is being asked. Told to pick “the most useful one” a writer picks, and a collection flow was asked for its bank account first and its beneficiary second — the last question of the flow — and then read all six out as a menu. So the list is ordered by declaration and the writer is told to ask for the first.
Ordering rather than a single “current” obligation, because some domains genuinely have several open at once — a proposal reviewed in one answer, three extras with no payer that one message can close two of — and a shape that forced exactly one would make those unsayable.
blocking_interaction: Option<InteractionRequirement>Zero or one blocking interaction requirement (I5, I6).
notices: Vec<WorkflowNotice>Informational, non-blocking elements.
outcome: Option<T>Present only when the workflow is complete.
Implementations§
Source§impl<P, O, T> WorkflowView<P, O, T>
impl<P, O, T> WorkflowView<P, O, T>
Sourcepub fn new(
case_ref: CaseRef,
workflow_version: WorkflowVersion,
phase: P,
) -> Self
pub fn new( case_ref: CaseRef, workflow_version: WorkflowVersion, phase: P, ) -> Self
A view with a phase and nothing else.
Sourcepub fn with_obligations(self, obligations: impl IntoIterator<Item = O>) -> Self
pub fn with_obligations(self, obligations: impl IntoIterator<Item = O>) -> Self
Adds obligations.
Sourcepub fn with_blocking_interaction(
self,
requirement: InteractionRequirement,
) -> Self
pub fn with_blocking_interaction( self, requirement: InteractionRequirement, ) -> Self
Sets the blocking requirement.
Sourcepub fn with_notice(self, notice: WorkflowNotice) -> Self
pub fn with_notice(self, notice: WorkflowNotice) -> Self
Adds a notice.
Sourcepub fn with_outcome(self, outcome: T) -> Self
pub fn with_outcome(self, outcome: T) -> Self
Sets the outcome.
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Returns true when an outcome is present.
Sourcepub fn has_obligations(&self) -> bool
pub fn has_obligations(&self) -> bool
Returns true when obligations remain.
Source§impl<P: Serialize, O: Serialize, T: Serialize> WorkflowView<P, O, T>
impl<P: Serialize, O: Serialize, T: Serialize> WorkflowView<P, O, T>
Sourcepub fn erase(
&self,
ownership: PhaseOwnership,
) -> Result<ErasedWorkflowView, HashError>
pub fn erase( &self, ownership: PhaseOwnership, ) -> Result<ErasedWorkflowView, HashError>
Erases the generics into canonical JSON, attaching the phase ownership the definition declares.
Trait Implementations§
Source§impl<'de, P, O, T> Deserialize<'de> for WorkflowView<P, O, T>
impl<'de, P, O, T> Deserialize<'de> for WorkflowView<P, O, T>
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<P: Eq, O: Eq, T: Eq> Eq for WorkflowView<P, O, T>
Source§impl<P, O, T> Serialize for WorkflowView<P, O, T>
impl<P, O, T> Serialize for WorkflowView<P, O, T>
impl<P: PartialEq, O: PartialEq, T: PartialEq> StructuralPartialEq for WorkflowView<P, O, T>
Auto Trait Implementations§
impl<P, O, T> Freeze for WorkflowView<P, O, T>
impl<P, O, T> RefUnwindSafe for WorkflowView<P, O, T>
impl<P, O, T> Send for WorkflowView<P, O, T>
impl<P, O, T> Sync for WorkflowView<P, O, T>
impl<P, O, T> Unpin for WorkflowView<P, O, T>
impl<P, O, T> UnsafeUnpin for WorkflowView<P, O, T>
impl<P, O, T> UnwindSafe for WorkflowView<P, O, T>
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.