diff options
author | Marcel Müller <m.mueller@ifm.com> | 2022-02-10 14:00:05 +0100 |
---|---|---|
committer | Matthias Beyer <matthias.beyer@ifm.com> | 2022-03-04 15:03:53 +0100 |
commit | 517c4bf19ea5c059d0043076a7ac7e823567ec6a (patch) | |
tree | d4f9e0d1390a3752bd125c2f7e1284b6e6d3e857 /crates/core/tedge_api/examples | |
parent | 21d7556690369b1084fe9ac1716c6bad59871d97 (diff) |
Make PluginBuilder methods async
Allowing them to be async means that they can do slightly more
complicated methods of checking configuration and instantiating
plugins. (Like IO to check for file existence, etc..)
Signed-off-by: Marcel Müller <m.mueller@ifm.com>
Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
Diffstat (limited to 'crates/core/tedge_api/examples')
-rw-r--r-- | crates/core/tedge_api/examples/heartbeat.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/crates/core/tedge_api/examples/heartbeat.rs b/crates/core/tedge_api/examples/heartbeat.rs index 80f8b10e..7776e488 100644 --- a/crates/core/tedge_api/examples/heartbeat.rs +++ b/crates/core/tedge_api/examples/heartbeat.rs @@ -8,19 +8,20 @@ use tedge_api::{ struct HeartbeatServiceBuilder; +#[async_trait] impl PluginBuilder for HeartbeatServiceBuilder { fn name(&self) -> &'static str { todo!() } - fn verify_configuration( + async fn verify_configuration( &self, _config: &PluginConfiguration, ) -> Result<(), tedge_api::errors::PluginError> { Ok(()) } - fn instantiate( + async fn instantiate( &self, config: PluginConfiguration, tedge_comms: tedge_api::plugins::Comms, @@ -89,7 +90,7 @@ async fn main() { ) .unwrap(); - let mut heartbeat = hsb.instantiate(config, comms).unwrap(); + let mut heartbeat = hsb.instantiate(config, comms).await.unwrap(); heartbeat.setup().await.unwrap(); |