<commit_before>use lazy_static::lazy_static;

use super::{week2, year1, Manufacturer, Matcher, MatcherDef, Year};

#[derive(Clone, Debug, Eq, PartialEq)]
pub struct HexInverter {
    pub manufacturer: Option<Manufacturer>,
    pub chip_type: Option<String>,
    pub year: Option<Year>,
    pub week: Option<u8>,
}

/// ```
/// # use gbhwdb_backend::parser::parse_hex_inverter;
/// assert!(parse_hex_inverter("LVX 04 8 45").is_some());
/// ```
fn tc74lvx04ft() -> MatcherDef<HexInverter> {
    MatcherDef(
        r#"^LVX\ 04\ ([0-9])\ ([0-9]{2})$"#,
        move |c| {
            Ok(HexInverter {
                manufacturer: Some(Manufacturer::Toshiba),
                chip_type: Some("TC74LVX04FT".to_owned()),
                year: Some(year1(&c[1])?),
                week: Some(week2(&c[2])?),
            })
        },
    )
}

pub fn parse_hex_inverter(text: &str) -> Option<HexInverter> {
    lazy_static! {
        static ref MATCHER: Matcher<HexInverter> = tc74lvx04ft().into();
    }
    MATCHER.apply(text)
}<commit_msg>Reformat<commit_after>use lazy_static::lazy_static;

use super::{week2, year1, Manufacturer, Matcher, MatcherDef, Year};

#[derive(Clone, Debug, Eq, PartialEq)]
pub struct HexInverter {
    pub manufacturer: Option<Manufacturer>,
    pub chip_type: Option<String>,
    pub year: Option<Year>,
    pub week: Option<u8>,
}

/// ```
/// # use gbhwdb_backend::parser::parse_hex_inverter;
/// assert!(parse_hex_inverter("LVX 04 8 45").is_some());
/// ```
fn tc74lvx04ft() -> MatcherDef<HexInverter> {
    MatcherDef(r#"^LVX\ 04\ ([0-9])\ ([0-9]{2})$"#, move |c| {
        Ok(HexInverter {
            manufacturer: Some(Manufacturer::Toshiba),
            chip_type: Some("TC74LVX04FT".to_owned()),
            year: Some(year1(&c[1])?),
            week: Some(week2(&c[2])?),
        })
    })
}

pub fn parse_hex_inverter(text: &str) -> Option<HexInverter> {
    lazy_static! {
        static ref MATCHER: Matcher<HexInverter> = tc74lvx04ft().into();
    }
    MATCHER.apply(text)
}
{'fraction_non_alphanumeric': 0.1772591857000993, 'fraction_numerical': 0.030784508440913606, 'mean_word_length': 3.1038696537678208, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4719406', 'n_tokens_mistral': 769, 'n_tokens_neox': 739, 'n_words': 129}