in reverie-ptrace/src/gdbstub/commands/base/_h_upper.rs [20:48]
fn parse(mut bytes: BytesMut) -> Option<Self> {
if bytes.is_empty() {
None
} else {
let (ch, bytes) = bytes.split_first_mut()?;
let op = match *ch {
b'c' => Some(ThreadOp::c),
b'g' => Some(ThreadOp::g),
b'G' => Some(ThreadOp::G),
b'm' => Some(ThreadOp::m),
b'M' => Some(ThreadOp::M),
_ => None,
}?;
if bytes == &b"-1"[..] {
Some(H {
op,
id: ThreadId::all(),
})
} else if bytes == &b"0"[..] {
Some(H {
op,
id: ThreadId::any(),
})
} else {
let thread_id = ThreadId::decode(bytes)?;
Some(H { op, id: thread_id })
}
}
}