ControlFlowBuilder

Struct ControlFlowBuilder 

Source
pub struct ControlFlowBuilder<P> { /* private fields */ }

Implementations§

Source§

impl<P: ControlFlowProtocol> ControlFlowBuilder<P>

Source

pub fn new() -> Self

Source

pub fn add_node<I, O, F>(&mut self, logic: F) -> NodeType<I, O>
where F: Fn(I) -> O + Copy + Send + Sync + 'static, I: FromProtocol<P> + 'static, O: ToProtocol<P> + 'static,

Adds a causaloid (function) to the graph.

§Arguments
  • logic: A strictly typed function Fn(I) -> O.

If strict-zst feature is enabled: logic MUST be a Zero-Sized Type (ZST), i.e., a function item, not a closure or pointer.

§Returns

A NodeType<I, O> that preserves the type information for linking.

Source

pub fn connect<S, T, U>( &mut self, source: NodeType<S, T>, target: NodeType<T, U>, )

Creates a directed connection between two nodes.

§Compiler Enforcement

This function signature enforces that the Output type of the Source matches the Input type of the Target.

If T does not match, the code will fail to compile with E0308.

Source

pub fn build(self) -> ExecutableGraph<P>

Finalizes the builder and returns the executable graph. This consumes the builder (Type State Pattern).

Trait Implementations§

Source§

impl<P: ControlFlowProtocol> Default for ControlFlowBuilder<P>

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.