• Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 use super::prelude::*;
2 
3 #[derive(Debug)]
4 pub struct M<'a> {
5     pub addr: &'a [u8],
6     pub len: usize,
7     pub val: &'a [u8],
8 }
9 
10 impl<'a> ParseCommand<'a> for M<'a> {
from_packet(buf: PacketBuf<'a>) -> Option<Self>11     fn from_packet(buf: PacketBuf<'a>) -> Option<Self> {
12         let body = buf.into_body();
13 
14         let mut body = body.split_mut(|&b| b == b',' || b == b':');
15         let addr = decode_hex_buf(body.next()?).ok()?;
16         let len = decode_hex(body.next()?).ok()?;
17         let val = body.next()?;
18 
19         Some(M {
20             addr,
21             len,
22             val: decode_hex_buf(val).ok()?,
23         })
24     }
25 }
26