forked from daniel5151/gdbstub
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_qWasmStackValue.rs
More file actions
27 lines (25 loc) · 788 Bytes
/
Copy path_qWasmStackValue.rs
File metadata and controls
27 lines (25 loc) · 788 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
use super::prelude::*;
#[derive(Debug)]
pub struct qWasmStackValue {
pub frame: u32,
pub index: u32,
}
impl<'a> ParseCommand<'a> for qWasmStackValue {
#[inline(always)]
fn from_packet(buf: PacketBuf<'a>) -> Option<Self> {
let body = buf.into_body();
if body.is_empty() || body[0] != b':' {
return None;
}
let mut parts = body[1..].split(|b| *b == b';');
let frame = parts.next()?;
let frame = str::from_utf8(frame).ok()?.parse::<u32>().ok()?;
let index = parts.next()?;
let index = str::from_utf8(index).ok()?.parse::<u32>().ok()?;
if parts.next().is_some() {
// Too many parameters.
return None;
}
Some(qWasmStackValue { frame, index })
}
}