I have experience using Haskell parsec libraries, and in Haskell, we just use functions everywhere.
Rust nom provides Parser trait and any type that implements it can be used like instance.parse(intput).
But combinators like map do not return Parser
pub fn map<I, O1, O2, E, F, G>(
first: F,
second: G
) -> impl FnMut(I) -> IResult<I, O2, E>
where
F: Parser<I, O1, E>,
G: FnMut(O1) -> O2,
I want to know that, when we should prefer the Parser trait and when we should prefer impl FnMut(I) -> IResult<I, O2, E>.
My guess is that, we always prefer using Parser trait as params (so we have less restrictions on the params) and impl FnMut as returns (so it's more convenient for users to use).