with_daemon
- An async client-daemon abstraction framework
This crate abstracts away the spawning of and connecting to a daemon required to optimize tasks performed by multiple client instances that run in separate processes.
The daemon runs in a separate detached process from the first time the client is used and provides functionality to multiple instances of the client, taking advantage of the ability to have a common state shared between client handlers.
Usage
See an example from examples/counter.rs
:
//! `with_daemon` example: a simple global counter
//!
//! This example demonstrates how to use `with_daemon` in the most basic way.
//!
//! The daemon keeps track of a counter and each call to the client returns the current counter
//! value and increments the counter.
//!
//! When the compiled binary is executed, it spawns the daemon if it's not running yet, and
//! receives the current value from the daemon. This way each execution of the program provides a
//! different integer, until the daemon is manually killed.
use ;
use ;
use with_daemon;
See all examples in examples/
.