diff --git a/src/combinator/multi.rs b/src/combinator/multi.rs index d0636287..0c686942 100644 --- a/src/combinator/multi.rs +++ b/src/combinator/multi.rs @@ -842,14 +842,14 @@ where pub fn separated_foldl1( mut parser: P, mut sep: S, - op: Op, + mut op: Op, ) -> impl Parser where I: Stream, P: Parser, S: Parser, E: ParserError, - Op: Fn(O, O2, O) -> O, + Op: FnMut(O, O2, O) -> O, { trace("separated_foldl1", move |i: &mut I| { let mut ol = parser.parse_next(i)?; @@ -911,14 +911,14 @@ where pub fn separated_foldr1( mut parser: P, mut sep: S, - op: Op, + mut op: Op, ) -> impl Parser where I: Stream, P: Parser, S: Parser, E: ParserError, - Op: Fn(O, O2, O) -> O, + Op: FnMut(O, O2, O) -> O, { trace("separated_foldr1", move |i: &mut I| { let ol = parser.parse_next(i)?; diff --git a/src/combinator/parser.rs b/src/combinator/parser.rs index c95f1f6f..55f8b99d 100644 --- a/src/combinator/parser.rs +++ b/src/combinator/parser.rs @@ -35,7 +35,7 @@ where pub struct Map where F: Parser, - G: Fn(O) -> O2, + G: FnMut(O) -> O2, { parser: F, map: G, @@ -48,7 +48,7 @@ where impl Map where F: Parser, - G: Fn(O) -> O2, + G: FnMut(O) -> O2, { #[inline(always)] pub(crate) fn new(parser: F, map: G) -> Self { @@ -66,7 +66,7 @@ where impl Parser for Map where F: Parser, - G: Fn(O) -> O2, + G: FnMut(O) -> O2, { #[inline] fn parse_next(&mut self, i: &mut I) -> PResult { @@ -393,7 +393,7 @@ where pub struct Verify where F: Parser, - G: Fn(&O2) -> bool, + G: FnMut(&O2) -> bool, I: Stream, O: Borrow, O2: ?Sized, @@ -410,7 +410,7 @@ where impl Verify where F: Parser, - G: Fn(&O2) -> bool, + G: FnMut(&O2) -> bool, I: Stream, O: Borrow, O2: ?Sized, @@ -432,7 +432,7 @@ where impl Parser for Verify where F: Parser, - G: Fn(&O2) -> bool, + G: FnMut(&O2) -> bool, I: Stream, O: Borrow, O2: ?Sized, diff --git a/src/parser.rs b/src/parser.rs index 8a1040dc..48e8be0c 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -382,7 +382,7 @@ pub trait Parser { #[inline(always)] fn map(self, map: G) -> Map where - G: Fn(O) -> O2, + G: FnMut(O) -> O2, Self: core::marker::Sized, { Map::new(self, map) @@ -581,7 +581,7 @@ pub trait Parser { fn verify(self, filter: G) -> Verify where Self: core::marker::Sized, - G: Fn(&O2) -> bool, + G: FnMut(&O2) -> bool, I: Stream, O: crate::lib::std::borrow::Borrow, O2: ?Sized,