pub struct NodeIOBuilder {
pub layout: NodeLayout,
pub inputs: HashSet<Uuid>,
pub outputs: HashSet<Uuid>,
pub queries: HashSet<Uuid>,
pub queryables: HashSet<Uuid>,
pub labels: HashMap<Uuid, String>,
}Expand description
This is the object passed to the user’s lambda function to build the node’s IO layout
Fields§
§layout: NodeLayoutThe node layout this io builder is applied to
inputs: HashSet<Uuid>The runtime only cares about input UUIDs
outputs: HashSet<Uuid>The runtime only cares about output UUIDs
queries: HashSet<Uuid>The runtime only cares about query UUIDs
queryables: HashSet<Uuid>The runtime only cares about queryable UUIDs
labels: HashMap<Uuid, String>Labels for the node’s IO, useful for debugging and visualization
Implementations§
Source§impl NodeIOBuilder
impl NodeIOBuilder
pub fn new(layout: &NodeLayout) -> NodeIOBuilder
Sourcepub fn input(&mut self, input: impl Into<String>) -> IOLayout
pub fn input(&mut self, input: impl Into<String>) -> IOLayout
Creates a new input layout with the given label
Examples found in repository?
examples/simple_flows.rs (line 15)
4async fn main() -> Result<()> {
5 let mut layout = DataflowLayout::new();
6
7 let (_source, output) = layout
8 .node("source", async |builder: &mut NodeIOBuilder| {
9 builder.output("out")
10 })
11 .await;
12
13 let (_operator, (op_in, op_out)) = layout
14 .node("operator", async |builder: &mut NodeIOBuilder| {
15 (builder.input("in"), builder.output("out"))
16 })
17 .await;
18
19 let (_sink, input) = layout
20 .node("sink", async |builder: &mut NodeIOBuilder| {
21 builder.input("in")
22 })
23 .await;
24
25 let layout = layout.build();
26
27 let _flows = Flows::new(layout.clone(), async move |builder: &mut FlowsBuilder| {
28 builder.connect(op_in, output, None)?;
29 builder.connect(input, op_out, None)?;
30
31 Ok(())
32 })
33 .await?;
34
35 Ok(())
36}Sourcepub fn output(&mut self, output: impl Into<String>) -> IOLayout
pub fn output(&mut self, output: impl Into<String>) -> IOLayout
Creates a new output layout with the given label
Examples found in repository?
examples/simple_flows.rs (line 9)
4async fn main() -> Result<()> {
5 let mut layout = DataflowLayout::new();
6
7 let (_source, output) = layout
8 .node("source", async |builder: &mut NodeIOBuilder| {
9 builder.output("out")
10 })
11 .await;
12
13 let (_operator, (op_in, op_out)) = layout
14 .node("operator", async |builder: &mut NodeIOBuilder| {
15 (builder.input("in"), builder.output("out"))
16 })
17 .await;
18
19 let (_sink, input) = layout
20 .node("sink", async |builder: &mut NodeIOBuilder| {
21 builder.input("in")
22 })
23 .await;
24
25 let layout = layout.build();
26
27 let _flows = Flows::new(layout.clone(), async move |builder: &mut FlowsBuilder| {
28 builder.connect(op_in, output, None)?;
29 builder.connect(input, op_out, None)?;
30
31 Ok(())
32 })
33 .await?;
34
35 Ok(())
36}Sourcepub fn query(&mut self, query: impl Into<String>) -> IOLayout
pub fn query(&mut self, query: impl Into<String>) -> IOLayout
Creates a new query layout with the given label
Examples found in repository?
examples/service_flows.rs (line 15)
4async fn main() -> Result<()> {
5 let mut layout = DataflowLayout::new();
6
7 let (_service, queryable) = layout
8 .node("service", async |builder: &mut NodeIOBuilder| {
9 builder.queryable("queryable")
10 })
11 .await;
12
13 let (_client, query) = layout
14 .node("client", async |builder: &mut NodeIOBuilder| {
15 builder.query("query")
16 })
17 .await;
18
19 let layout = layout.build();
20
21 let _flows = Flows::new(layout.clone(), async move |builder: &mut FlowsBuilder| {
22 builder.connect(query, queryable, None)?;
23
24 Ok(())
25 })
26 .await?;
27
28 Ok(())
29}Sourcepub fn queryable(&mut self, queryable: impl Into<String>) -> IOLayout
pub fn queryable(&mut self, queryable: impl Into<String>) -> IOLayout
Creates a new queryable layout with the given label
Examples found in repository?
examples/service_flows.rs (line 9)
4async fn main() -> Result<()> {
5 let mut layout = DataflowLayout::new();
6
7 let (_service, queryable) = layout
8 .node("service", async |builder: &mut NodeIOBuilder| {
9 builder.queryable("queryable")
10 })
11 .await;
12
13 let (_client, query) = layout
14 .node("client", async |builder: &mut NodeIOBuilder| {
15 builder.query("query")
16 })
17 .await;
18
19 let layout = layout.build();
20
21 let _flows = Flows::new(layout.clone(), async move |builder: &mut FlowsBuilder| {
22 builder.connect(query, queryable, None)?;
23
24 Ok(())
25 })
26 .await?;
27
28 Ok(())
29}Auto Trait Implementations§
impl Freeze for NodeIOBuilder
impl RefUnwindSafe for NodeIOBuilder
impl Send for NodeIOBuilder
impl Sync for NodeIOBuilder
impl Unpin for NodeIOBuilder
impl UnsafeUnpin for NodeIOBuilder
impl UnwindSafe for NodeIOBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more