pub trait Worker: Send + Sync {
// Required methods
fn name(&self) -> &'static str;
fn description(&self) -> &'static str;
fn example(&self) -> &'static str;
fn handle<'life0, 'async_trait>(
&'life0 self,
db: DatabaseConnection,
msg: MessageEvent,
args: HashMap<String, String>,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
A Worker receives a MessageEvent from the SensoriumLoop and handles it.
§Contract
- The worker writes any
ProcessEvents it generates to theprocess_eventstable viadb. - Return
Ok(true)if the message was accepted and handled,Ok(false)to pass.
Required Methods§
Sourcefn description(&self) -> &'static str
fn description(&self) -> &'static str
One-line description shown in /help output.
Sourcefn example(&self) -> &'static str
fn example(&self) -> &'static str
Example invocation shown in /help output (e.g. “/task list”).
fn handle<'life0, 'async_trait>(
&'life0 self,
db: DatabaseConnection,
msg: MessageEvent,
args: HashMap<String, String>,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".