Builder

Struct Builder 

Source
pub struct Builder<Input, Output, Error, Context, NodeTypes = (), NodeIOETypes = ()>
where Input: Send, Error: Send, Context: Send,
{ /* private fields */ }
Expand description

Builder for SequentialFlow.

This builder ensures:

  • Input into the flow can be converted into the input of the first node
  • output of the last node can be converted into the Output of the flow
  • error of all nodes can be converted into the Error of the flow
  • output of a previous node can be converted into the input of the next node

See also SequentialFlow.

Implementations§

Source§

impl<Input, Output, Error, Context> Builder<Input, Output, Error, Context>
where Input: Send, Error: Send, Context: Send,

Source

pub fn new() -> Self

Creates a new empty builder for SequentialFlow.

Source

pub fn add_node<NodeType, NodeInput, NodeOutput, NodeError>( self, node: NodeType, ) -> Builder<Input, Output, Error, Context, (NodeType,), ((), (NodeInput, NodeOutput<NodeOutput>, NodeError))>
where Input: Into<NodeInput>, NodeError: Into<Error>, NodeType: Node<NodeInput, NodeOutputStruct<NodeOutput>, NodeError, Context> + Clone + Send + Sync, NodeInput: Send,

Adds a new node.

The new node must satisfy:

  • Self: Node<NodeInputType, NodeOutput<NodeOutputType>, NodeErrorType, _>
  • Input: Into<NodeInputType>,
  • NodeErrorType: Into<Error>,
§Returns

A new Builder with the added node.

Source§

impl<Input, Output, Error, Context, NodeTypes, LastNodeInType, LastNodeOutType, LastNodeErrType, OtherNodeIOETypes> Builder<Input, Output, Error, Context, NodeTypes, (OtherNodeIOETypes, (LastNodeInType, NodeOutput<LastNodeOutType>, LastNodeErrType))>
where Input: Send, Error: Send, Context: Send,

Source

pub fn add_node<NodeType, NodeInput, NodeOutput, NodeError>( self, node: NodeType, ) -> Builder<Input, Output, Error, Context, (NodeTypes, NodeType), ((OtherNodeIOETypes, (LastNodeInType, NodeOutput<LastNodeOutType>, LastNodeErrType)), (NodeInput, NodeOutput<NodeOutput>, NodeError))>
where LastNodeOutType: Into<NodeInput>, NodeError: Into<Error>, NodeType: Node<NodeInput, NodeOutputStruct<NodeOutput>, NodeError, Context> + Clone + Send + Sync, NodeInput: Send,

Adds a new node.

The new node must satisfy:

  • Self: Node<NodeInputType, NodeOutput<NodeOutputType>, NodeErrorType, _>
  • NodeErrorType: Into<Error>,
  • LastNodeOutputType: Into<NodeInputType>,
§Returns

A new Builder with the added node.

Source

pub fn build( self, ) -> Flow<Input, Output, Error, Context, NodeTypes, (OtherNodeIOETypes, (LastNodeInType, NodeOutput<LastNodeOutType>, LastNodeErrType))>
where LastNodeOutType: Into<Output>,

Finalizes the builder and produces a SequentialFlow instance.

Trait Implementations§

Source§

impl<Input, Output, Error, Context, NodeTypes, NodeIOETypes> Debug for Builder<Input, Output, Error, Context, NodeTypes, NodeIOETypes>
where NodeTypes: ChainDebug, Input: Send, Error: Send, Context: Send,

Source§

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

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

impl<Input, Output, Error, Context> Default for Builder<Input, Output, Error, Context>
where Input: Send, Error: Send, Context: Send,

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl<Input, Output, Error, Context, NodeTypes, NodeIOETypes> Freeze for Builder<Input, Output, Error, Context, NodeTypes, NodeIOETypes>
where NodeTypes: Freeze,

§

impl<Input, Output, Error, Context, NodeTypes, NodeIOETypes> RefUnwindSafe for Builder<Input, Output, Error, Context, NodeTypes, NodeIOETypes>
where NodeTypes: RefUnwindSafe,

§

impl<Input, Output, Error, Context, NodeTypes, NodeIOETypes> Send for Builder<Input, Output, Error, Context, NodeTypes, NodeIOETypes>
where NodeTypes: Send,

§

impl<Input, Output, Error, Context, NodeTypes, NodeIOETypes> Sync for Builder<Input, Output, Error, Context, NodeTypes, NodeIOETypes>
where NodeTypes: Sync,

§

impl<Input, Output, Error, Context, NodeTypes, NodeIOETypes> Unpin for Builder<Input, Output, Error, Context, NodeTypes, NodeIOETypes>
where NodeTypes: Unpin,

§

impl<Input, Output, Error, Context, NodeTypes, NodeIOETypes> UnwindSafe for Builder<Input, Output, Error, Context, NodeTypes, NodeIOETypes>
where NodeTypes: 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, 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.
Source§

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

Source§

fn vzip(self) -> V