Rust Daemon
A library to simplify communication with daemons in rust, this uses tokio and serde to establish a type-safe json over unix socket interface for client-daemon communication, and is intended to be extended with other useful daemon-writing features as they are discovered.
This consists of a Server that handles Requests from and issues Responses to Clients, and a Client that issues Requests to and receives Responses from a Server.
Status
Usage
See src/examples/server.rs for an example server, and src/examples/client.rs for an example client.
Request
and Response
objects must implement serde Serialize
and Deserialize
traits, these may be implemented using serde_derive.
Client
extern crate daemon_engine;
use Client;
...
// Create client instance
let client = new.unwrap;
// Split RX and TX
let = client.split;
// Send something (remember to .wait())
tx.send.wait.unwrap;
// Receive something (also remember to wait)
rx.map.wait.next;
Server
extern crate daemon_engine;
use Server;
...
let server_handle = lazy;
// Create server task
run;
``
------
If you have any questions, comments, or suggestions, feel free to open an issue or a pull request.