Workflow

Struct Workflow 

Source
pub struct Workflow<Start, Current, Backend, T = Identity> { /* private fields */ }
Expand description

A workflow represents a sequence of steps to be executed in order.

Implementations§

Source§

impl<Start, Cur, B, L> Workflow<Start, Cur, B, L>
where B: BackendExt,

Source

pub fn and_then<F, O, FnArgs>( self, and_then: F, ) -> Workflow<Start, O, B, Stack<AndThen<TaskFn<F, Cur, B::Context, FnArgs>>, L>>
where TaskFn<F, Cur, B::Context, FnArgs>: Service<Task<Cur, B::Context, B::IdType>, Response = O>,

Adds a transformation step to the workflow that processes the output of the previous step.

The and_then method allows you to chain operations by providing a function that takes the result of the current workflow step and transforms it into the input for the next step. This enables building complex processing pipelines with type-safe transformations between steps.

§Example
workflow
    .and_then(extract)
    .and_then(transform)
    .and_then(load);
Source§

impl<Start, Cur, B, L> Workflow<Start, Cur, B, L>

Source

pub fn delay_for( self, delay: Duration, ) -> Workflow<Start, Cur, B, Stack<DelayFor, L>>

Delay the workflow by a fixed duration

Source§

impl<Start, Cur, B, L> Workflow<Start, Cur, B, L>

Source

pub fn delay_with<F, I>( self, f: F, ) -> Workflow<Start, I, B, Stack<DelayWith<F, B, I>, L>>

Delay the workflow by a duration determined by a function

Source§

impl<Start, C, L, I: IntoIterator<Item = C>, B: BackendExt> Workflow<Start, I, B, L>

Source

pub fn filter_map<F, Output, FnArgs>( self, filter_map: F, ) -> Workflow<Start, Vec<Output>, B, Stack<FilterMap<TaskFn<F, C, B::Context, FnArgs>, I>, L>>
where TaskFn<F, C, B::Context, FnArgs>: Service<Task<C, B::Context, B::IdType>, Response = Option<Output>>,

Adds a filter and map step to the workflow.

Source§

impl<Start, C, L, I: IntoIterator<Item = C>, B: BackendExt> Workflow<Start, I, B, L>

Source

pub fn fold<F, Output, FnArgs, Init>( self, fold: F, ) -> Workflow<Start, Output, B, Stack<Fold<TaskFn<F, (Init, C), B::Context, FnArgs>, Init>, L>>
where TaskFn<F, (Init, C), B::Context, FnArgs>: Service<Task<(Init, C), B::Context, B::IdType>, Response = Output>,

Folds over a collection of items in the workflow.

Source§

impl<Start, Backend> Workflow<Start, Start, Backend>

Source

pub fn new(name: &str) -> Self

Source§

impl<Start, Cur, B, L> Workflow<Start, Cur, B, L>

Source

pub fn add_step<S, Output>( self, step: S, ) -> Workflow<Start, Output, B, Stack<S, L>>

Adds a new step to the workflow pipeline.

Source

pub fn finalize<S>(self, root: S) -> Workflow<Start, Cur, B, L::Step>
where S: Step<Cur, B>, L: Layer<S>, B: BackendExt,

Finalizes the workflow by attaching a root step.

Source§

impl<Start, Cur, B, L> Workflow<Start, Cur, B, L>
where B: BackendExt,

Source

pub fn build<N>(self) -> L::Step
where L: Layer<RootStep<N>>,

Builds the workflow by layering the root step.

Trait Implementations§

Source§

impl<Start: Debug, Current: Debug, Backend: Debug, T: Debug> Debug for Workflow<Start, Current, Backend, T>

Source§

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

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

impl<Input, Output, Current, B, Compact, Err, L> IntoWorkerService<B, WorkflowService<B, Output>, Compact, <B as Backend>::Context> for Workflow<Input, Current, B, L>
where B: BackendExt<Compact = Compact> + Send + Sync + 'static + Sink<Task<Compact, B::Context, B::IdType>, Error = Err> + Unpin + Clone + Backend<Args = Compact, Error = Err>, Err: Error + Send + Sync + 'static, B::Context: MetadataExt<WorkflowContext> + Send + Sync + 'static, B::IdType: Send + 'static + Default + GenerateId, B::Compact: Send + Sync + 'static, <B::Context as MetadataExt<WorkflowContext>>::Error: Into<BoxDynError>, L: Layer<RootStep<Current>>, L::Step: Step<Output, B>,

Source§

type Backend = RawDataBackend<B>

The backend type for the worker
Source§

fn into_service( self, b: B, ) -> WorkerService<RawDataBackend<B>, WorkflowService<B, Output>>

Build the service from the backend

Auto Trait Implementations§

§

impl<Start, Current, Backend, T> Freeze for Workflow<Start, Current, Backend, T>
where T: Freeze,

§

impl<Start, Current, Backend, T> RefUnwindSafe for Workflow<Start, Current, Backend, T>
where T: RefUnwindSafe, Start: RefUnwindSafe, Current: RefUnwindSafe, Backend: RefUnwindSafe,

§

impl<Start, Current, Backend, T> Send for Workflow<Start, Current, Backend, T>
where T: Send, Start: Send, Current: Send, Backend: Send,

§

impl<Start, Current, Backend, T> Sync for Workflow<Start, Current, Backend, T>
where T: Sync, Start: Sync, Current: Sync, Backend: Sync,

§

impl<Start, Current, Backend, T> Unpin for Workflow<Start, Current, Backend, T>
where T: Unpin, Start: Unpin, Current: Unpin, Backend: Unpin,

§

impl<Start, Current, Backend, T> UnwindSafe for Workflow<Start, Current, Backend, T>
where T: UnwindSafe, Start: UnwindSafe, Current: UnwindSafe, Backend: UnwindSafe,

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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, Args, Ctx, Svc, B, M> IntoWorkerServiceExt<Args, Ctx, Svc, B, M> for T
where T: IntoWorkerService<B, Svc, Args, Ctx>, B: Backend<Args = Args, Context = Ctx>, Svc: Service<Task<Args, Ctx, <B as Backend>::IdType>>,

Source§

fn build_with( self, builder: WorkerBuilder<Args, Ctx, B, M>, ) -> Worker<Args, Ctx, <T as IntoWorkerService<B, Svc, Args, Ctx>>::Backend, Svc, M>

Consumes the builder and returns a worker
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more