pub struct WorkflowBuilder {
pub id: String,
pub name: String,
pub phases: Vec<Phase>,
pub transitions: Vec<Transition>,
}Expand description
Builder for constructing validated WorkflowDefinition instances.
Fields§
§id: StringThe unique identifier for the workflow.
name: StringHuman-readable name for the workflow.
phases: Vec<Phase>The phases that make up this workflow.
transitions: Vec<Transition>The transitions between phases in this workflow.
Implementations§
Source§impl WorkflowBuilder
impl WorkflowBuilder
Sourcepub fn new(id: &str, name: &str) -> Self
pub fn new(id: &str, name: &str) -> Self
Creates a new WorkflowBuilder instance with the given ID and name,
defaulting phases and transitions to empty lists.
Sourcepub fn add_transition(self, transition: Transition) -> Self
pub fn add_transition(self, transition: Transition) -> Self
Adds a Transition to the workflow.
Sourcepub fn build(self) -> Result<WorkflowDefinition, ValidationErrors>
pub fn build(self) -> Result<WorkflowDefinition, ValidationErrors>
Builds a validated WorkflowDefinition from the WorkflowBuilder instance.
§Returns
A Result containing the WorkflowDefinition if valid, or a
validator::ValidationErrors if validation fails.
Trait Implementations§
Source§impl Clone for WorkflowBuilder
impl Clone for WorkflowBuilder
Source§fn clone(&self) -> WorkflowBuilder
fn clone(&self) -> WorkflowBuilder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for WorkflowBuilder
impl Debug for WorkflowBuilder
Source§impl<'de> Deserialize<'de> for WorkflowBuilder
impl<'de> Deserialize<'de> for WorkflowBuilder
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for WorkflowBuilder
impl Serialize for WorkflowBuilder
Source§impl TryFrom<WorkflowBuilder> for WorkflowDefinition
impl TryFrom<WorkflowBuilder> for WorkflowDefinition
Source§type Error = ValidationErrors
type Error = ValidationErrors
The type returned in the event of a conversion error.
Auto Trait Implementations§
impl Freeze for WorkflowBuilder
impl RefUnwindSafe for WorkflowBuilder
impl Send for WorkflowBuilder
impl Sync for WorkflowBuilder
impl Unpin for WorkflowBuilder
impl UnwindSafe for WorkflowBuilder
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