Crates.io | conflagrate |
lib.rs | conflagrate |
version | 0.1.0 |
source | src |
created_at | 2022-04-08 00:24:59.679133 |
updated_at | 2022-04-26 01:20:19.749985 |
description | A framework for building applications from control flow graphs |
homepage | |
repository | https://github.com/ignirtoq/conflagrate-rs |
max_upload_size | |
id | 563980 |
size | 22,554 |
Build applications from control flow graphs, rather than the other way around.
Conflagrate is a framework for building applications structured as the control flow graphs they end up becoming anyway.
Build the pieces of your application as self-contained nodes. Arrange and rearrange control flow logic as your needs mature and change without having to go back and rewrite the glue code connecting your components.
Define your application control flow with a graph.
conflagrate::graph!{
digraph MessageHandlerGraph {
listen[label="Listen on a Socket for a Message", type=Listen, start=true];
handle_message[label="Handle the Message", type=HandleMessage];
listen -> handle_message; // Handle the message
listen -> listen; // Listen for the next message
}
}
Write a function for each type of node in your application.
use conflagrate::nodetype;
#[nodetype]
async fn Listen(interface: &SocketInterface) -> String {
interface.receive().await
}
#[nodetype]
async fn HandleMessage(message: String, logger: &Logger) {
logger.log(message);
}
Run the application.
fn main() {
MessageHandlerGraph::run(());
}