pub enum ShepherdMessage {
Shutdown,
Action {
name: String,
params: Option<String>,
id: u64,
},
}Expand description
Daemon→child message
Variants§
Shutdown
Graceful-stop request (shutdown_with_message)
Action
Custom action dispatch
Fields
params: Option<String>Argument text for the action, passed through to the child
verbatim; None when the action was triggered without any.
Absent from the serialized form when None, and absent on the
wire deserializes back to None, so a message carrying no
arguments is byte-identical to one from before this field
existed. That is what makes the field additive on a channel that
has no version to negotiate — see the spec’s §9 note on
trigger.
One opaque string, not structured data: the daemon never reads it, and an app that wants JSON, a flag list or a bare word parses it in the grammar it already has.
id: u64This dispatch’s correlation id, unique for the life of the
daemon. Echo it back on your ChildMessage::ActionReply as
id and the daemon matches your answer to this exact request
rather than to its name.
Always present, unlike params: an app that ignores the key is
unaffected, and an app that wants to echo must never have to
handle its absence. u64 and monotonically increasing, but
neither of those is a promise an app should lean on — treat it as
an opaque token to hand back.
Trait Implementations§
Source§impl Clone for ShepherdMessage
impl Clone for ShepherdMessage
Source§fn clone(&self) -> ShepherdMessage
fn clone(&self) -> ShepherdMessage
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more