summaryrefslogtreecommitdiffstats
path: root/crates
diff options
context:
space:
mode:
authorMatthias Beyer <matthias.beyer@ifm.com>2022-03-22 15:08:42 +0100
committerMatthias Beyer <matthias.beyer@ifm.com>2022-03-22 15:09:26 +0100
commit1a7edb63fdd2423bae12165b18d8178a49067fa3 (patch)
treea0702aa29fb7b085881deb27505c2698c252b809 /crates
parenta1e93a5e82f0f551495dedd18e13992ee31d2e6a (diff)
Update doc for HandleTypes
This patch updates the docs for the HandleTypes type and adapts all doc tests to the new interfaces. Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
Diffstat (limited to 'crates')
-rw-r--r--crates/core/tedge_api/src/plugin.rs24
1 files changed, 19 insertions, 5 deletions
diff --git a/crates/core/tedge_api/src/plugin.rs b/crates/core/tedge_api/src/plugin.rs
index e3adb66e..ee905664 100644
--- a/crates/core/tedge_api/src/plugin.rs
+++ b/crates/core/tedge_api/src/plugin.rs
@@ -336,26 +336,40 @@ impl HandleTypes {
///
/// ```rust
/// # use async_trait::async_trait;
- /// # use tedge_api::plugin::{Message, Handle, HandleTypes};
+ /// # use tedge_api::plugin::{Handle, HandleTypes};
+ /// # use tedge_api::address::ReplySender;
/// # use tedge_api::PluginError;
///
+ /// #[derive(Debug)]
/// struct Heartbeat;
///
- /// impl Message for Heartbeat {}
+ /// impl tedge_api::plugin::Message for Heartbeat {
+ /// type Reply = tedge_api::message::NoReply;
+ /// }
///
/// struct HeartbeatPlugin;
///
/// #[async_trait]
/// impl Handle<Heartbeat> for HeartbeatPlugin {
- /// async fn handle_message(&self, message: Heartbeat) -> Result<(), PluginError> {
+ /// async fn handle_message(&self, message: Heartbeat, sender: ReplySender<tedge_api::message::NoReply>) -> Result<(), PluginError> {
/// // ... Do something with it
///# Ok(())
/// }
/// }
///
- /// # impl Plugin for HeartbeatPlugin { }
+ /// # use tedge_api::{Address, CoreMessages, error::DirectoryError, address::ReceiverBundle};
+ /// # #[async_trait::async_trait]
+ /// # impl tedge_api::Plugin for HeartbeatPlugin {
+ /// # async fn setup(&mut self) -> Result<(), PluginError> {
+ /// # unimplemented!()
+ /// # }
+ /// #
+ /// # async fn shutdown(&mut self) -> Result<(), PluginError> {
+ /// # unimplemented!()
+ /// # }
+ /// # }
///
- /// println!("{:#?}", HandleTypes::get_handlers_for::<(Heartbeat,), HeartbeatPlugin>());
+ /// println!("{:#?}", HandleTypes::declare_handlers_for::<(Heartbeat,), HeartbeatPlugin>());
/// // This will print something akin to:
/// //
/// // HandleTypes(