Function parser_compose::any_slice

source ·
pub fn any_slice<T>(ctx: ParserContext<&[T]>) -> Res<&[T], &[T]>
Expand description

A parser that recognizes the first item in a slice.

Errors

An error is reported if the slice is empty

use parser_compose::{Parser, any_slice};

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

let (value, _) = any_slice(msg.into()).unwrap();

assert_eq!(value, [254]);