Attempts to claim `bytes` bytes out of `input`.
(input: &mut &'a [u8], bytes: usize)
| 3 | |
| 4 | /// Attempts to claim `bytes` bytes out of `input`. |
| 5 | pub fn consume_bytes<'a>(input: &mut &'a [u8], bytes: usize) -> Result<&'a [u8]> { |
| 6 | if bytes > input.len() { |
| 7 | return err("EOF"); |
| 8 | } |
| 9 | let (bytes, remaining) = input.split_at(bytes); |
| 10 | *input = remaining; |
| 11 | Ok(bytes) |
| 12 | } |
| 13 | |
| 14 | /// Attempts to claim one byte out of `input`. |
| 15 | pub fn consume_byte(input: &mut &[u8]) -> Result<u8> { |
no test coverage detected