mqtt_format/v3/
will.rs

1//
2//   This Source Code Form is subject to the terms of the Mozilla Public
3//   License, v. 2.0. If a copy of the MPL was not distributed with this
4//   file, You can obtain one at http://mozilla.org/MPL/2.0/.
5//
6
7use super::{qos::MQualityOfService, strings::MString};
8
9#[derive(Debug, Clone, Copy, PartialEq, Eq)]
10pub struct MLastWill<'message> {
11    pub topic: MString<'message>,
12    pub payload: &'message [u8],
13    pub qos: MQualityOfService,
14    pub retain: bool,
15}
16
17impl<'message> MLastWill<'message> {
18    pub fn get_len(&self) -> usize {
19        MString::get_len(&self.topic) + (2 + self.payload.len())
20    }
21}