1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
use crate as hitori;
pub struct Score;
#[hitori::impl_expr(and_expr_mut)]
// this defines `ScoreCaptureMut` and `ScoreCaptureRanges`
#[hitori::and_define(capture_mut, capture_ranges)]
impl<C: ScoreCaptureMut> Expr<C, usize, char> for Score {
const PATTERN: _ = (
// this calls `ScoreCaptureMut::left` on matched range
#[hitori::capture(left)]
(|ch: char| ch.is_digit(10)),
|ch| ch == ':',
// this calls `ScoreCaptureMut::right` on matched range
#[hitori::capture(right)]
(|ch: char| ch.is_digit(10)),
);
}