Function neure::re::start

source ·
pub fn start() -> AnchorStart
Expand description

Match the start position of data.

Example

    let pos = re::start();
    let rust = re::string("rust");
    let year = neu::digit(10).repeat_times::<4>();
    let mut ctx = CharsCtx::new("rust2023");

    assert_eq!(ctx.try_mat(&pos)?, Span::new(0, 0));
    assert_eq!(ctx.try_mat(&rust)?, Span::new(0, 4));
    assert_eq!(ctx.try_mat(&year)?, Span::new(4, 4));

    Ok(())