From 517c4bf19ea5c059d0043076a7ac7e823567ec6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=BCller?= Date: Thu, 10 Feb 2022 14:00:05 +0100 Subject: Make PluginBuilder methods async MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Matthias Beyer --- crates/core/tedge_api/examples/heartbeat.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'crates/core/tedge_api/examples') 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(); -- cgit v1.2.3