diff options
author | Matthias Beyer <matthias.beyer@ifm.com> | 2022-07-02 16:49:06 +0200 |
---|---|---|
committer | Matthias Beyer <matthias.beyer@ifm.com> | 2022-08-30 13:54:48 +0200 |
commit | d0555de786e97a638e5d6f468510ca95bb12c161 (patch) | |
tree | 5b603eeabd982ad163e1ceba66c113d1e6ef17e4 | |
parent | 08a32f3294d65b4011e54838fc67c792cf8f3ff0 (diff) |
Make MessageType impl Copy
We can make the Uuid helper type Copy, because bevy_reflect::Uuid implements Copy.
We can make the `MessageKind` type Copy after that and we can make the
`MessageType` type Copy because of that.
This is a prerequisite for changing the `ReceiverBundle::get_ids()`
function to return an iterator over a static slice, which we want to do
to reduce the number of allocations here, because allocating a
`Vec<MessageType>` is just too much ;-).
Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
-rw-r--r-- | crates/core/tedge_api/src/message.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/core/tedge_api/src/message.rs b/crates/core/tedge_api/src/message.rs index 34656a3e..7def83d8 100644 --- a/crates/core/tedge_api/src/message.rs +++ b/crates/core/tedge_api/src/message.rs @@ -74,16 +74,16 @@ impl AnyMessage { impl Message for AnyMessage {} /// The type of a message as used by `tedge_api` to represent a type -#[derive(Debug, Clone, Serialize)] +#[derive(Debug, Clone, Copy, Serialize)] pub struct MessageType { name: &'static str, kind: MessageKind, } -#[derive(Clone, PartialEq, Debug)] +#[derive(Clone, Copy, PartialEq, Debug)] struct Uuid(bevy_reflect::Uuid); -#[derive(Debug, Clone, Serialize)] +#[derive(Debug, Clone, Copy, Serialize)] enum MessageKind { Wildcard, #[serde(skip)] |