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