1 use super::prelude::*; 2 use crate::common::Pid; 3 use crate::protocol::common::qxfer::ParseAnnex; 4 use crate::protocol::common::qxfer::QXferReadBase; 5 6 pub type qXferExecFileRead<'a> = QXferReadBase<'a, ExecFileAnnex>; 7 8 #[derive(Debug)] 9 pub struct ExecFileAnnex { 10 pub pid: Option<Pid>, 11 } 12 13 impl<'a> ParseAnnex<'a> for ExecFileAnnex { 14 #[inline(always)] from_buf(buf: &[u8]) -> Option<Self>15 fn from_buf(buf: &[u8]) -> Option<Self> { 16 let pid = match buf { 17 [] => None, 18 buf => Some(Pid::new(decode_hex(buf).ok()?)?), 19 }; 20 21 Some(ExecFileAnnex { pid }) 22 } 23 } 24