summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <matthias.beyer@ifm.com>2022-09-27 09:34:04 +0200
committerMatthias Beyer <matthias.beyer@ifm.com>2022-09-27 09:34:41 +0200
commit72ad2cbb8a56fe4e9d44fa4cc1aefa185bab78df (patch)
tree0a6f6098ee36eee37c4343ebe37681dcc646fef5
parent5d04affae76a1f3c7d0f7f232b7b59589c2c6bdf (diff)
Add MessageType::uuid() getter
This patch adds a getter to get the bevy_reflect::Uuid from a MessageType object. That is required for proper error reporting. Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
-rw-r--r--crates/core/tedge_api/src/message.rs9
-rw-r--r--crates/core/tedge_core/Cargo.toml1
2 files changed, 10 insertions, 0 deletions
diff --git a/crates/core/tedge_api/src/message.rs b/crates/core/tedge_api/src/message.rs
index f7beb94c..63f5f1ad 100644
--- a/crates/core/tedge_api/src/message.rs
+++ b/crates/core/tedge_api/src/message.rs
@@ -150,6 +150,15 @@ impl MessageType {
_ => false,
}
}
+
+ /// Get the UUID of the MessageType
+ #[must_use]
+ pub fn uuid(&self) -> Option<bevy_reflect::Uuid> {
+ match &self.kind {
+ MessageKind::Typed(uuid) => Some(uuid.0),
+ MessageKind::Wildcard => None,
+ }
+ }
}
/// A message to tell the core to stop thin-edge
diff --git a/crates/core/tedge_core/Cargo.toml b/crates/core/tedge_core/Cargo.toml
index 726377af..e6afaaff 100644
--- a/crates/core/tedge_core/Cargo.toml
+++ b/crates/core/tedge_core/Cargo.toml
@@ -15,6 +15,7 @@ tokio = { version = "1.16.1", features = ["fs", "macros", "rt", "sync"] }
tokio-util = "0.7"
toml = "0.5.8"
tracing = "0.1"
+bevy_reflect = "0.7.0"
tedge_api = { path = "../tedge_api" }
itertools = "0.10.3"