Skip to main content

Sensor

Trait Sensor 

Source
pub trait Sensor: Module {
    // Required methods
    fn attach(&mut self, events: ActorRef<ControlEvent>);
    fn start(&mut self);
}
Expand description

External input that produces ControlEvents and dispatches them via a shared ActorRef.

Sensor extends Module so every sensor is also a rack module.

Required Methods§

Source

fn attach(&mut self, events: ActorRef<ControlEvent>)

Attach the sensor to an event sink.

Called before start. The sensor stores the ActorRef and uses it to send events during its lifetime.

Source

fn start(&mut self)

Start the sensor (begin polling, open device, spawn thread, etc.).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§