pub trait Machine<T>: Send + Sync{
// Required method
fn receive(&self, cmd: T);
// Provided methods
fn disconnected(&self) { ... }
fn connected(&self, _uuid: Uuid) { ... }
}
Expand description
The machine is the common trait all machines must implement and describes how instuctions are delivered to a machine, via the receive method.
Required Methods§
Provided Methods§
Sourcefn disconnected(&self)
fn disconnected(&self)
The disconnected method is called to notify the machine that its receiver has become disconnect; it will no longer receive instructions. This could be a result of server shutdown, or all senders dropping their senders.
Sourcefn connected(&self, _uuid: Uuid)
fn connected(&self, _uuid: Uuid)
The connected method is called once, before receive messages. It provides a notification that the machine has become connected and may receive instructions. It includes a Uuid for the machine, which may be used in logging. A machine implementing several instruction sets will receive a differnt Uuid for each instruction set implemented.