• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 use super::prelude::*;
2 
3 #[derive(Debug)]
4 pub struct qTBuffer {
5     pub offset: u64,
6     pub length: usize,
7 }
8 
9 impl<'a> ParseCommand<'a> for qTBuffer {
10     #[inline(always)]
from_packet(buf: PacketBuf<'a>) -> Option<Self>11     fn from_packet(buf: PacketBuf<'a>) -> Option<Self> {
12         let (buf, body_range) = buf.into_raw_buf();
13         let body = &buf[body_range];
14         match body {
15             [b':', body @ ..] => {
16                 let mut req_opts = body.split(|b| *b == b',');
17                 let (offset, length) = (req_opts.next()?, req_opts.next()?);
18                 let offset = decode_hex(offset).ok()?;
19                 let length = decode_hex(length).ok()?;
20                 Some(qTBuffer { offset, length })
21             }
22             _ => None,
23         }
24     }
25 }
26