Rust/combine/regex -- filling in an arg for Capture

Code:

use combine::parser::regex::{captures, Captures};
use combine::Parser;
use std::fs;

fn main() -> anyhow::Result<()> {
    let comment = regex::Regex::new(r"%[^\n]*\n").unwrap();
    let mut c: combine::parser::regex::Captures<_, regex::Regex, &str> = captures(comment);
    let y = c.parse("hello world")?;
    /*
    println!("{:?}", y);
     */
    Ok(())
}

I can not figure out what to fill in for the first type arg to regex::Captures.

I am using

https://docs.rs/combine/4.5.2/combine/
https://docs.rs/regex/1.4.3/regex/

The first type argument is passed through as the Output associated type in impl Parser for Captures. So, you should probably specify the type you are trying to parse into.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.