Rust Component Layer for D3 -- A Framework for Server Development
The components layer provides an organization hierarchy for machines. It is based upon a Component/Coordinator/Connector model, and while not the only possible model, it is one I like. This layer is where the network is exposed. It is an adapter wrapping Mio.
Usage
Add this to your Cargo.toml
:
[]
= "0.1.0"
= "0.1.0"
= "0.1.0"
Example Listening on an address:port
extern crate d3_derive;
use *;
use executor;
use network;
// A trivial Alice
// Implement the Machine trait for Alice
// Start the scheduler and executor and network
start_server;
start_network;
// create the Machine from Alice, getting back a machine and Sender<StateTable>.
let = connect;
// send a command to the network asking for Alice to
// be notified if a connection is received for 127.0.0.1:4000
let cmd = BindListener;
get_network_sender.send.expect;
// Stop the scheduler and executor and network
start_network;
stop_server;