home ~ socials ~ projects ~ rss

Apply Type To Tuple Parser In Rust's nom Crate

July 2023

TODO

    Write this up as a full example

tuple((
    tag("```"),
    not_line_ending,
    line_ending,
    take_until("```"),
    tag("```"),
))
.map(
    |(_, x, _, y, _): (&str, &str, &str, &str, &str)| Section::Code {
        lang: Some(x.trim().to_string()),
        text: y.trim().to_string(),
    },
),
end of line
Share link:
https://www.alanwsmith.com/en/2s/o9/jt/aj/?apply-type-to-tuple-parser-in-rust-s-nom-crate