1

I have a parser setup where I've injected dbg_dmp to the best of my ability:

permutation((
        check_eye_color,
        check_passport_id,
        check_birth_year,
        check_issue_year,
        check_expiry_year,
        check_hair_color,
        check_height,
        dbg_dmp(check_cid, "cid"),
    ))(input)

This gives me:

error[E0277]: expected a `FnMut<(&str,)>` closure, found `impl Fn<(&[u8],)>`

No clue why or how to resolve this.

Alper
  • 3,424
  • 4
  • 39
  • 45
  • 1
    Looks like your `check_cid()` function does not have the right signature – yolenoyer Dec 05 '20 at 20:00
  • Without the `dbg_dmp` it does fit in there, so how does it not have the right signature? – Alper Dec 05 '20 at 20:01
  • 1
    https://docs.rs/nom/6.0.1/nom/fn.dbg_dmp.html – yolenoyer Dec 05 '20 at 20:02
  • 1
    `where F: Fn(&'a [u8]) -> IResult<&'a [u8], O, E>` – yolenoyer Dec 05 '20 at 20:03
  • 1
    That would seem like it, but wouldn't it then be kinda useless? It is implied here that you can generically use them to debug your stuff: https://github.com/Geal/nom/blob/master/doc/error_management.md – Alper Dec 05 '20 at 20:04
  • Also as a beginner I can't read those function signatures to save my life. I find them absurdly unhelpful. – Alper Dec 05 '20 at 20:04
  • Sorry, can't help anymore, I'm missing something as well (never used `dbg_dmp()`) – yolenoyer Dec 05 '20 at 20:07
  • It could be that the debugging options are only for macro nom and not for new nom. The `nom_trace` crate definitely seems to be. – Alper Dec 05 '20 at 20:16

0 Answers0