1 use super::prelude::*; 2 use crate::protocol::common::thread_id::ThreadId; 3 4 #[derive(Debug)] 5 pub enum Op { 6 StepContinue, 7 Other, 8 } 9 10 #[derive(Debug)] 11 pub struct H { 12 pub kind: Op, 13 pub thread: ThreadId, 14 } 15 16 impl<'a> ParseCommand<'a> for H { 17 #[inline(always)] from_packet(buf: PacketBuf<'a>) -> Option<Self>18 fn from_packet(buf: PacketBuf<'a>) -> Option<Self> { 19 let body = buf.into_body(); 20 if body.is_empty() { 21 return None; 22 } 23 24 let kind = match body[0] { 25 b'g' => Op::Other, 26 b'c' => Op::StepContinue, 27 _ => return None, 28 }; 29 let thread: ThreadId = body[1..].try_into().ok()?; 30 31 Some(H { kind, thread }) 32 } 33 } 34