aboutsummaryrefslogtreecommitdiff
path: root/src/protocol/commands/_qRcmd.rs
blob: 62f1d0d61d5a6fd3ca34a3d3d475e8efd917aa83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use super::prelude::*;

#[derive(Debug)]
pub struct qRcmd<'a> {
    pub hex_cmd: &'a [u8],
}

impl<'a> ParseCommand<'a> for qRcmd<'a> {
    #[inline(always)]
    fn from_packet(buf: PacketBuf<'a>) -> Option<Self> {
        crate::__dead_code_marker!("qRcmd", "from_packet");

        let body = buf.into_body();
        match body {
            [] => Some(qRcmd { hex_cmd: &[] }),
            [b',', hex_cmd @ ..] => Some(qRcmd {
                hex_cmd: decode_hex_buf(hex_cmd).ok()?,
            }),
            _ => None,
        }
    }
}