"Τὰ πάντα ῥεῖ καὶ οὐδὲν μένει" — Heraclitus
Building blocks for flow-based programming (FBP) in Rust. This collection of crates implements a growing shrink-wrap inventory of standard, reusable dataflow blocks for common use cases.
Tip
🚧 We are building in public. This is presently under heavy construction.
[Features] | [Prerequisites] | [Installation] | [Examples] | [Reference] | [Development]
- Provides components for flow-based programming (FBP) based on Tokio.
- Enables dataflow systems through reusable components called blocks.
- Built on the dataflow primitives provided by the Async-Flow project.
- Supports opting out of any feature using comprehensive feature flags.
- Adheres to the Rust API Guidelines in its naming conventions.
- Cuts red tape: 100% free and unencumbered public domain software.
- Rust 1.85+ (2024 edition)
cargo add flowsuse flows::{audio, hash, image, io, json, math, rand, text};use flows::{Inputs, Outputs, Result};
/// A block that splits input strings based on a delimiter.
async fn split_string(delim: &str, mut ins: Inputs<String>, outs: Outputs<String>) -> Result {
while let Some(input) = ins.recv().await? {
for output in input.split(delim) {
outs.send(output.into()).await?;
}
}
Ok(())
}use flows::{Inputs, Outputs, Result};
/// A block that outputs the sums of input numbers.
async fn add_ints(mut lhs: Inputs<i64>, mut rhs: Inputs<i64>, sums: Outputs<i64>) -> Result {
loop {
let (a, b) = tokio::try_join!(lhs.recv(), rhs.recv())?;
match (a, b) {
(Some(a), Some(b)) => sums.send(a + b).await?,
_ => break,
}
}
Ok(())
}| Package | Summary | Crate | Documentation |
|---|---|---|---|
| flows | Flow-based programming (FBP). | ||
| flows-arrow | Flow-based data processing with Apache Arrow. | ||
| flows-audio | Flow-based audio processing. | ||
| flows-datafusion | Flow-based query processing with Apache DataFusion. | ||
| flows-derive | Derive macros for flow-based programming (FBP). | ||
| flows-hash | Flow-based cryptographic hashing. | ||
| flows-http | Flow-based HTTP requests & responses. | ||
| flows-image | Flow-based image processing. | ||
| flows-io | Flow-based I/O readers & writers. | ||
| flows-json | Flow-based JSON encoding & decoding. | ||
| flows-math | Flow-based mathematical operations. | ||
| flows-rand | Flow-based random number generation. | ||
| flows-text | Flow-based text processing. |
TBD
-
System: A collection of blocks that are connected together. Systems are the top-level entities in dataflow programs.
-
Block: An encapsulated system component that processes messages. Blocks are the autonomous units of computation in a system.
-
Port: A named connection point on a block that sends or receives messages. Ports are the only interfaces through which blocks communicate with each other.
-
Message: A unit of data that flows between blocks in a system, from port to port. Any Rust type that implements the
Send + Sync + 'statictraits can be used as a message.
git clone https://github.com/artob/flows.rs.git