Struct FlowBuilder

Source
pub struct FlowBuilder { /* private fields */ }
Expand description

Builder for creating flows with a fluent API

Implementations§

Source§

impl FlowBuilder

Source

pub fn new() -> Self

Creates a new FlowBuilder

Source

pub fn step<Fut, F>(self, f: F) -> Self
where F: FnMut(SharedContext) -> Fut + Send + 'static, Fut: Future<Output = Result<()>> + Send + 'static,

Adds a simple step to the flow

Source

pub fn named_step<Fut, F>(self, name: &'static str, f: F) -> Self
where F: FnMut(SharedContext) -> Fut + Send + 'static, Fut: Future<Output = Result<()>> + Send + 'static,

Adds a named step to the flow with automatic logging

Source

pub fn step_if<Fut, F, Cond>(self, cond: Cond, f: F) -> Self
where Cond: Fn(&FlowContext) -> bool + Send + Sync + 'static, F: FnMut(SharedContext) -> Fut + Send + 'static, Fut: Future<Output = Result<()>> + Send + 'static,

Adds a conditional step that only executes if the condition is met

Source

pub fn wait_until<Cond>( self, cond: Cond, interval: Duration, max_retry: usize, ) -> Self
where Cond: Fn(&FlowContext) -> bool + Send + Sync + 'static,

Adds a wait step that waits until a condition is met

Source

pub fn build(self) -> Flow

Builds the flow

Source

pub fn into_steps(self) -> Vec<Step>

Access steps for runtime extensions

Source

pub async fn execute(self) -> Result<FlowContext>

Builds and executes the flow immediately

Source

pub async fn execute_with_context( self, context: FlowContext, ) -> Result<FlowContext>

Builds and executes the flow with a custom context

Trait Implementations§

Source§

impl Default for FlowBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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<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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.