1 | use alloc::collections::VecDeque; |
---|---|
2 | |
3 | use super::Buf; |
4 | |
5 | impl Buf for VecDeque<u8> { |
6 | fn remaining(&self) -> usize { |
7 | self.len() |
8 | } |
9 | |
10 | fn chunk(&self) -> &[u8] { |
11 | let (s1: &[u8], s2: &[u8]) = self.as_slices(); |
12 | if s1.is_empty() { |
13 | s2 |
14 | } else { |
15 | s1 |
16 | } |
17 | } |
18 | |
19 | fn advance(&mut self, cnt: usize) { |
20 | self.drain(..cnt); |
21 | } |
22 | } |
23 |