rumqttc/mqttbytes/v4/
ping.rs

1use super::*;
2use bytes::{BufMut, BytesMut};
3
4#[derive(Debug, Clone, PartialEq, Eq)]
5pub struct PingReq;
6
7impl PingReq {
8    pub fn size(&self) -> usize {
9        2
10    }
11
12    pub fn write(&self, payload: &mut BytesMut) -> Result<usize, Error> {
13        payload.put_slice(&[0xC0, 0x00]);
14        Ok(2)
15    }
16}
17
18#[derive(Debug, Clone, PartialEq, Eq)]
19pub struct PingResp;
20
21impl PingResp {
22    pub fn size(&self) -> usize {
23        2
24    }
25
26    pub fn write(&self, payload: &mut BytesMut) -> Result<usize, Error> {
27        payload.put_slice(&[0xD0, 0x00]);
28        Ok(2)
29    }
30}