Skip to main content

WireDsl

Trait WireDsl 

Source
pub trait WireDsl: Shape + Clone {
    // Provided methods
    fn to<D>(&self, inlet: D) -> WirePair<Self, D>
       where Self: AutoOutletEndpoint { ... }
    fn out(&self, index: usize) -> OutletCursor<Self> { ... }
    fn in_(&self, index: usize) -> InletCursor<Self> { ... }
}
Expand description

Shape extension methods for method-based graph wiring.

to intentionally supports only shapes with an unambiguous auto-outlet. MergePreferredShape and BidiShape are explicit-only.

use datum::{Broadcast, GraphDsl, GraphFlowShape, MergePreferred, WireDsl};

let _ = GraphDsl::try_create(|builder| {
    let merge = builder.add(MergePreferred::<u64>::new(1));
    let bcast = builder.add(Broadcast::<u64>::new(2));

    builder.wire(merge.to(&bcast));

    Ok(GraphFlowShape::new(merge.secondary(0)?, bcast.outlet(0)?))
});
use datum::{BidiShape, FlowShape, GraphDsl, Inlet, Outlet, WireDsl};

let _ = GraphDsl::try_create(|builder| {
    let bidi = BidiShape::new(
        Inlet::<u64>::new("bidi.in1"),
        Outlet::<u64>::new("bidi.out1"),
        Inlet::<u64>::new("bidi.in2"),
        Outlet::<u64>::new("bidi.out2"),
    );
    let flow = FlowShape::new(Inlet::<u64>::new("flow.in"), Outlet::<u64>::new("flow.out"));

    builder.wire(bidi.to(&flow));

    Ok(flow)
});

Provided Methods§

Source

fn to<D>(&self, inlet: D) -> WirePair<Self, D>
where Self: AutoOutletEndpoint,

Source

fn out(&self, index: usize) -> OutletCursor<Self>

Source

fn in_(&self, index: usize) -> InletCursor<Self>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<S> WireDsl for S
where S: Shape + Clone,