@@ -47,6 +47,18 @@ use crate::stream::{Recover, Recoverable};
4747/// - `&[u8]` and `&str`, see [`winnow::token::literal`][crate::token::literal]
4848pub trait Parser < I , O , E > {
4949 /// Parse all of `input`, generating `O` from it
50+ ///
51+ /// This is intended for integrating your parser into the rest of your application.
52+ ///
53+ /// For one [`Parser`] to drive another [`Parser`] forward or for
54+ /// [incremental parsing][StreamIsPartial], see instead [`Parser::parse_next`].
55+ ///
56+ /// This assumes the [`Parser`] intends to read all of `input` and will return an
57+ /// [`eof`][crate::combinator::eof] error if it does not
58+ /// To ignore trailing `input`, combine your parser with a [`rest`][crate::token::rest]
59+ /// (e.g. `(parser, rest).parse(input)`).
60+ ///
61+ /// See also the [tutorial][crate::_tutorial::chapter_6].
5062 #[ inline]
5163 fn parse ( & mut self , mut input : I ) -> Result < O , ParseError < I , <E as ParserError < I > >:: Inner > >
5264 where
@@ -76,9 +88,12 @@ pub trait Parser<I, O, E> {
7688
7789 /// Take tokens from the [`Stream`], turning it into the output
7890 ///
79- /// This includes advancing the [`Stream`] to the next location.
91+ /// This includes advancing the input [`Stream`] to the next location.
8092 ///
8193 /// On error, `input` will be left pointing at the error location.
94+ ///
95+ /// This is intended for a [`Parser`] to drive another [`Parser`] forward or for
96+ /// [incremental parsing][StreamIsPartial]
8297 fn parse_next ( & mut self , input : & mut I ) -> Result < O , E > ;
8398
8499 /// Take tokens from the [`Stream`], turning it into the output
0 commit comments