diff options
Diffstat (limited to 'vendor/winnow/src/combinator/parser.rs')
-rw-r--r-- | vendor/winnow/src/combinator/parser.rs | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/vendor/winnow/src/combinator/parser.rs b/vendor/winnow/src/combinator/parser.rs index 969c2d525..fb11adc15 100644 --- a/vendor/winnow/src/combinator/parser.rs +++ b/vendor/winnow/src/combinator/parser.rs @@ -14,12 +14,16 @@ pub struct ByRef<'p, P> { } impl<'p, P> ByRef<'p, P> { + #[inline(always)] pub(crate) fn new(p: &'p mut P) -> Self { Self { p } } } -impl<'p, I, O, E, P: Parser<I, O, E>> Parser<I, O, E> for ByRef<'p, P> { +impl<'p, I, O, E, P> Parser<I, O, E> for ByRef<'p, P> +where + P: Parser<I, O, E>, +{ #[inline(always)] fn parse_next(&mut self, i: &mut I) -> PResult<O, E> { self.p.parse_next(i) @@ -46,6 +50,7 @@ where F: Parser<I, O, E>, G: Fn(O) -> O2, { + #[inline(always)] pub(crate) fn new(parser: F, map: G) -> Self { Self { parser, @@ -97,6 +102,7 @@ where I: Stream, E: FromExternalError<I, E2>, { + #[inline(always)] pub(crate) fn new(parser: F, map: G) -> Self { Self { parser, @@ -154,6 +160,7 @@ where I: Stream, E: ParserError<I>, { + #[inline(always)] pub(crate) fn new(parser: F, map: G) -> Self { Self { parser, @@ -210,6 +217,7 @@ where O: StreamIsPartial, I: Stream, { + #[inline(always)] pub(crate) fn new(outer: F, inner: G) -> Self { Self { outer, @@ -265,6 +273,7 @@ where O: crate::stream::ParseSlice<O2>, E: ParserError<I>, { + #[inline(always)] pub(crate) fn new(p: P) -> Self { Self { p, @@ -319,6 +328,7 @@ where G: FnMut(O) -> H, H: Parser<I, O2, E>, { + #[inline(always)] pub(crate) fn new(f: F, g: G) -> Self { Self { f, @@ -352,6 +362,7 @@ pub struct CompleteErr<F> { } impl<F> CompleteErr<F> { + #[inline(always)] pub(crate) fn new(f: F) -> Self { Self { f } } @@ -405,6 +416,7 @@ where O2: ?Sized, E: ParserError<I>, { + #[inline(always)] pub(crate) fn new(parser: F, filter: G) -> Self { Self { parser, @@ -458,6 +470,7 @@ where F: Parser<I, O, E>, O2: Clone, { + #[inline(always)] pub(crate) fn new(parser: F, val: O2) -> Self { Self { parser, @@ -496,6 +509,7 @@ impl<F, I, O, E> Void<F, I, O, E> where F: Parser<I, O, E>, { + #[inline(always)] pub(crate) fn new(parser: F) -> Self { Self { parser, @@ -534,6 +548,7 @@ where F: Parser<I, O, E>, I: Stream, { + #[inline(always)] pub(crate) fn new(parser: F) -> Self { Self { parser, @@ -582,6 +597,7 @@ where F: Parser<I, O, E>, I: Stream, { + #[inline(always)] pub(crate) fn new(parser: F) -> Self { Self { parser, @@ -630,6 +646,7 @@ where F: Parser<I, O, E>, I: Stream + Location, { + #[inline(always)] pub(crate) fn new(parser: F) -> Self { Self { parser, @@ -673,6 +690,7 @@ where F: Parser<I, O, E>, I: Stream + Location, { + #[inline(always)] pub(crate) fn new(parser: F) -> Self { Self { parser, @@ -717,6 +735,7 @@ where F: Parser<I, O, E>, O: Into<O2>, { + #[inline(always)] pub(crate) fn new(parser: F) -> Self { Self { parser, @@ -758,6 +777,7 @@ where F: Parser<I, O, E>, E: Into<E2>, { + #[inline(always)] pub(crate) fn new(parser: F) -> Self { Self { parser, @@ -808,6 +828,7 @@ where E: AddContext<I, C>, C: Clone + crate::lib::std::fmt::Debug, { + #[inline(always)] pub(crate) fn new(parser: F, context: C) -> Self { Self { parser, @@ -835,7 +856,7 @@ where trace(name, move |i: &mut I| { (self.parser) .parse_next(i) - .map_err(|err| err.map(|err| err.add_context(i, self.context.clone()))) + .map_err(|err| err.add_context(i, self.context.clone())) }) .parse_next(i) } |