aboutsummaryrefslogtreecommitdiff
path: root/src/protocol/commands/_vKill.rs
blob: a1d687b0756493532eba779487faa1d1c71d1db8 (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 vKill {
    pub pid: Pid,
}

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