• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 use super::prelude::*;
2 
3 use crate::target::ext::host_io::FsKind;
4 
5 #[derive(Debug)]
6 pub struct vFileSetfs {
7     pub fs: FsKind,
8 }
9 
10 impl<'a> ParseCommand<'a> for vFileSetfs {
11     #[inline(always)]
from_packet(buf: PacketBuf<'a>) -> Option<Self>12     fn from_packet(buf: PacketBuf<'a>) -> Option<Self> {
13         let body = buf.into_body();
14         if body.is_empty() {
15             return None;
16         }
17 
18         match body {
19             [b':', body @ ..] => {
20                 let fs = match crate::common::Pid::new(decode_hex(body).ok()?) {
21                     None => FsKind::Stub,
22                     Some(pid) => FsKind::Pid(pid),
23                 };
24                 Some(vFileSetfs { fs })
25             }
26             _ => None,
27         }
28     }
29 }
30