slice

Function slice 

Source
pub fn slice<T>(slice: &'static [T]) -> SliceEqualParser<'static, T>
Expand description

Compare the input starts with the given slice.

for borrowing-safety, the lifetime of slice must be ’static. for non-static slice, use crate::vec() instead.

Output: ()

§Example

use rusty_parser as rp;
use rp::IntoParser;

let hello_parser = rp::slice(&[104, 101, 108, 108, 111]);
let hello_parser = (&[104, 101, 108, 108, 111]).into_parser();