Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/SantaClaas/embedded-fan-control.
Something went wrong. Try again.
525 B · 22 lines
Rust
1234567891011121314151617181920212223use core::convert::Infallible;
use crate::mqtt::TryEncode;
pub(crate) struct PingRequest;
impl PingRequest { pub(crate) const TYPE: u8 = 12;}
impl TryEncode for PingRequest { type Error = Infallible;
fn try_encode(&self, buffer: &mut [u8], offset: &mut usize) -> Result<(), Self::Error> { buffer[*offset] = Self::TYPE << 4; *offset += 1; // Setting it to 0, because this might not be 0 if we reuse the buffer buffer[*offset] = 0; *offset += 1; Ok(()) }}