Machine

Trait Machine 

Source
pub trait Machine<T>: Send + Sync
where T: 'static + 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§

Source

fn receive(&self, cmd: T)

The receive method receives instructions sent to it by itself or other machines.

Provided Methods§

Source

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.

Source

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.

Implementations on Foreign Types§

Source§

impl<T, P> Machine<P> for Mutex<T>
where T: Machine<P>, P: MachineImpl,

Source§

fn receive(&self, cmd: P)

Source§

fn disconnected(&self)

Source§

fn connected(&self, uuid: Uuid)

Implementors§