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

use crate::common::Pid;

#[derive(Debug)]
pub struct qAttached {
    pub pid: Option<Pid>,
}

impl<'a> ParseCommand<'a> for qAttached {
    #[inline(always)]
    fn from_packet(buf: PacketBuf<'a>) -> Option<Self> {
        let body = buf.into_body();
        let pid = match body {
            [b':', pid @ ..] => Some(Pid::new(decode_hex(pid).ok()?)?),
            _ => None,
        };
        Some(qAttached { pid })
    }
}