use crate::{MatchId, h1::parser::types::h1_action};
const H1A_NONE: u8 = 0;
const H1A_START_CAPTURE: u8 = 1;
const H1A_END_CAPTURE: u8 = 2;
const H1F_DONE: u8 = 1 << 0;
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub enum Action {
StartCapture(MatchId),
EndCapture(MatchId),
Done,
EndCaptureAndDone(MatchId),
}
impl From<Action> for h1_action {
fn from(value: Action) -> Self {
let (kind, flags, mid) = match value {
Action::Done => (H1A_NONE, H1F_DONE, 0),
Action::StartCapture(mid) => (H1A_START_CAPTURE, 0, mid.0 as u8),
Action::EndCapture(mid) => (H1A_END_CAPTURE, 0, mid.0 as u8),
Action::EndCaptureAndDone(mid) => (H1A_END_CAPTURE, H1F_DONE, mid.0 as u8),
};
h1_action { kind, flags, mid }
}
}