Function parser_compose::any_byte

source ·
pub fn any_byte(ctx: ParserContext<&[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, _) = any_byte(msg.into()).unwrap();

assert_eq!(value, [254]);