1 use super::prelude::*; 2 3 #[derive(Debug)] 4 pub struct QSetWorkingDir<'a> { 5 pub dir: Option<&'a [u8]>, 6 } 7 8 impl<'a> ParseCommand<'a> for QSetWorkingDir<'a> { 9 #[inline(always)] from_packet(buf: PacketBuf<'a>) -> Option<Self>10 fn from_packet(buf: PacketBuf<'a>) -> Option<Self> { 11 let body = buf.into_body(); 12 let dir = match body { 13 [b':', dir @ ..] => match decode_hex_buf(dir).ok()? { 14 [] => None, 15 s => Some(s as &[u8]), 16 }, 17 _ => return None, 18 }; 19 20 Some(QSetWorkingDir { dir }) 21 } 22 } 23