diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2024-03-21 09:59:52 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2024-03-21 09:59:52 +0100 |
commit | 79d57f6ccd5ff1a77a929f5d9d2e799a0a334c96 (patch) | |
tree | 862e9d44d31a9f4da626705c4ca654e0723f00a3 | |
parent | e4bb196a3b442858557a867a745db2ab3f5f562f (diff) |
Implement write() fn for all combined reason code types
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r-- | mqtt-format/src/v5/reason_code.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/mqtt-format/src/v5/reason_code.rs b/mqtt-format/src/v5/reason_code.rs index 10d88f2..4699027 100644 --- a/mqtt-format/src/v5/reason_code.rs +++ b/mqtt-format/src/v5/reason_code.rs @@ -25,6 +25,16 @@ macro_rules! make_combined_reason_code { .parse_next(input) }).parse_next(input) } + + pub async fn write<W: $crate::v5::write::WriteMqttPacket>(&self, buffer: &mut W) -> $crate::v5::write::WResult<W> { + match self { + $( + Self::$reason_code_name => buffer.write_byte(<$reason_code_type>::CODE).await?, + )* + } + + Ok(()) + } } } } |