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

use crate::common::Pid;
use crate::protocol::common::qxfer::{ParseAnnex, QXferReadBase};

pub type qXferExecFileRead<'a> = QXferReadBase<'a, ExecFileAnnex>;

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

impl<'a> ParseAnnex<'a> for ExecFileAnnex {
    #[inline(always)]
    fn from_buf(buf: &[u8]) -> Option<Self> {
        let pid = match buf {
            [] => None,
            buf => Some(Pid::new(decode_hex(buf).ok()?)?),
        };

        Some(ExecFileAnnex { pid })
    }
}