Skip to main content

gdbstub/protocol/commands/
_QSetWorkingDir.rs

1use super::prelude::*;
2
3#[derive(Debug)]
4pub struct QSetWorkingDir<'a> {
5    pub dir: Option<&'a [u8]>,
6}
7
8impl<'a> ParseCommand<'a> for QSetWorkingDir<'a> {
9    #[inline(always)]
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}