Function neure::neu::and

source ·
pub fn and<T, L: Neu<T>, R: Neu<T>>(left: L, right: R) -> And<L, R, T>
Expand description

Return true if the value matches both L and R.

Example

    const BEG: u8 = 'a' as u8 - 1;
    const END: u8 = 'z' as u8 + 1;

    let char = neu::and(|a: &u8| a > &BEG, |a: &u8| a < &END);
    let str = char.repeat_range(6..);
    let mut ctx = BytesCtx::new(br#"abcedfgABCEE"#);

    assert_eq!(ctx.try_mat(&str)?, Span::new(0, 7));
    Ok(())