Skip to main content

WorkflowView

Struct WorkflowView 

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

The case and the revision it was projected at.

§workflow_version: WorkflowVersion

Version of the definition that produced the view.

§phase: P

Exactly 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>

Source

pub fn new( case_ref: CaseRef, workflow_version: WorkflowVersion, phase: P, ) -> Self

A view with a phase and nothing else.

Source

pub fn with_obligations(self, obligations: impl IntoIterator<Item = O>) -> Self

Adds obligations.

Source

pub fn with_blocking_interaction( self, requirement: InteractionRequirement, ) -> Self

Sets the blocking requirement.

Source

pub fn with_notice(self, notice: WorkflowNotice) -> Self

Adds a notice.

Source

pub fn with_outcome(self, outcome: T) -> Self

Sets the outcome.

Source

pub fn is_complete(&self) -> bool

Returns true when an outcome is present.

Source

pub fn has_obligations(&self) -> bool

Returns true when obligations remain.

Source§

impl<P: Serialize, O: Serialize, T: Serialize> WorkflowView<P, O, T>

Source

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<P: Clone, O: Clone, T: Clone> Clone for WorkflowView<P, O, T>

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<P: Debug, O: Debug, T: Debug> Debug for WorkflowView<P, O, T>

Source§

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

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

impl<'de, P, O, T> Deserialize<'de> for WorkflowView<P, O, T>
where P: Deserialize<'de>, O: Deserialize<'de>, T: Deserialize<'de>,

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<P: Eq, O: Eq, T: Eq> Eq for WorkflowView<P, O, T>

Source§

impl<P: PartialEq, O: PartialEq, T: PartialEq> PartialEq for WorkflowView<P, O, T>

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<P, O, T> Serialize for WorkflowView<P, O, T>
where P: Serialize, O: Serialize, T: Serialize,

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<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>
where P: Freeze, Vec<O>: Freeze, Option<T>: Freeze,

§

impl<P, O, T> RefUnwindSafe for WorkflowView<P, O, T>

§

impl<P, O, T> Send for WorkflowView<P, O, T>
where P: Send, Vec<O>: Send, Option<T>: Send,

§

impl<P, O, T> Sync for WorkflowView<P, O, T>
where P: Sync, Vec<O>: Sync, Option<T>: Sync,

§

impl<P, O, T> Unpin for WorkflowView<P, O, T>
where P: Unpin, Vec<O>: Unpin, Option<T>: Unpin,

§

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