pub struct Workflow {
pub id: String,
pub name: Option<String>,
pub author: Option<String>,
pub description: Option<String>,
pub steps: Vec<Step>,
}
Expand description
Workflow
represent a executable workflow
A workflow is mainly defined in two parts:
- The metadata: this contains the workflow id, name, author, description
- The steps: these are the instructions that will be executed
Fields§
§id: String
The workflow id. This is mandatory and must be unique withing a executor context.
name: Option<String>
The optional workflow name.
The optional workflow author.
description: Option<String>
The optional workflow description.
steps: Vec<Step>
The steps to execute.
Implementations§
Source§impl Workflow
impl Workflow
Sourcepub fn from_file<P: AsRef<Path>>(path: P) -> Result<Self, Box<dyn Error>>
pub fn from_file<P: AsRef<Path>>(path: P) -> Result<Self, Box<dyn Error>>
from_file
allows to read a workflow from his yaml file definition
this will either return the loaded workflow, or an error if something goes wrong.
use workflow::Workflow;
use std::path::Path;
let workflow = Workflow::from_file(Path::new("my-workflow.yml")).expect("unable to load workflow");
Sourcepub fn execute(
&self,
workflows_cache: &HashMap<String, Workflow>,
config: &HashMap<String, String>,
) -> Result<(), Box<dyn Error>>
pub fn execute( &self, workflows_cache: &HashMap<String, Workflow>, config: &HashMap<String, String>, ) -> Result<(), Box<dyn Error>>
execute
will execute the workflow using given cache of workflow (to resolve referral step)
and linked config.
use workflow::Workflow;
use std::path::Path;
use std::collections::HashMap;
let workflow = Workflow::from_file(Path::new("my-workflow.yml")).expect("unable to load workflow");
workflow.execute(&HashMap::new(), &HashMap::new()).expect("unable to execute workflow");
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Workflow
impl<'de> Deserialize<'de> for Workflow
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
Auto Trait Implementations§
impl Freeze for Workflow
impl RefUnwindSafe for Workflow
impl Send for Workflow
impl Sync for Workflow
impl Unpin for Workflow
impl UnwindSafe for Workflow
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