• Home
  • 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> {
11     #[inline(always)]
from_packet(buf: PacketBuf<'a>) -> Option<Self>12     fn from_packet(buf: PacketBuf<'a>) -> Option<Self> {
13         let body = buf.into_body();
14 
15         let mut body = body.split_mut(|&b| b == b',' || b == b':');
16         let addr = decode_hex_buf(body.next()?).ok()?;
17         let len = decode_hex(body.next()?).ok()?;
18         let val = decode_hex_buf(body.next()?).ok()?;
19 
20         Some(M { addr, len, val })
21     }
22 }
23