Function parser_compose::any_byte

source ·
pub fn any_byte(input: &[u8]) -> Res<&[u8], &[u8], ()>
Expand description

A parser that recognizes the first byte in a byte slice.

Errors

An error is reported if the byte slice is empty

use parser_compose::{Parser, any_byte};

let msg = &[254, 1, 2][..];

let (value, rest) = any_byte(msg).unwrap();

assert_eq!(value, [254]);