macro_rules! daemon_main {
(
daemon: $daemon:expr,
keypair: $keypair:expr,
config: $config:expr,
dispatcher: $dispatcher:expr $(,)?
) => { ... };
}Expand description
One-call macro for the common “single daemon per process”
case. Expands to a tokio::main body that:
- Constructs a
MeshOsRuntimevia the supplied config + dispatcher, - Wraps the runtime in
MeshOsDaemonSdk, - Registers the supplied daemon + keypair,
- Drains control events; on
ShutdownorDrainFinish, breaks the loop, - Drives
graceful_shutdownon the handle, thenshutdownon the SDK.
ⓘ
daemon_main! {
name: "my-telemetry",
daemon: MyTelemetryDaemon::new(),
keypair: EntityKeypair::generate(),
config: MeshOsConfig::default(),
dispatcher: my_dispatcher,
}