diff --git a/src/bytes/mod.rs b/src/bytes/mod.rs index f5d3d97c..7e527c04 100644 --- a/src/bytes/mod.rs +++ b/src/bytes/mod.rs @@ -278,6 +278,8 @@ where /// /// *Partial version*: will return a `ErrMode::Incomplete(Needed::new(1))` if the pattern reaches the end of the input. /// +/// To recognize a series of tokens, use [`many0`][crate::multi::many0] to [`Accumulate`][crate::stream::Accumulate] into a `()` and then [`Parser::recognize`][crate::Parser::recognize]. +/// /// # Example /// /// ```rust @@ -334,6 +336,8 @@ where /// /// *Partial version* will return a `ErrMode::Incomplete(Needed::new(1))` or if the pattern reaches the end of the input. /// +/// To recognize a series of tokens, use [`many1`][crate::multi::many1] to [`Accumulate`][crate::stream::Accumulate] into a `()` and then [`Parser::recognize`][crate::Parser::recognize]. +/// /// # Example /// /// ```rust @@ -409,6 +413,8 @@ where /// /// *Partial version* will return a `ErrMode::Incomplete(Needed::new(1))` if the pattern reaches the end of the input or is too short. /// +/// To recognize a series of tokens, use [`many_m_n`][crate::multi::many_m_n] to [`Accumulate`][crate::stream::Accumulate] into a `()` and then [`Parser::recognize`][crate::Parser::recognize]. +/// /// # Example /// /// ```rust diff --git a/src/multi/mod.rs b/src/multi/mod.rs index 3ed2b297..aea8dd1a 100644 --- a/src/multi/mod.rs +++ b/src/multi/mod.rs @@ -11,13 +11,12 @@ use crate::stream::{Stream, StreamIsPartial, ToUsize, UpdateSlice}; use crate::trace::trace; use crate::{IResult, Parser}; -/// Repeats the embedded parser, gathering the results in a `Vec`. +/// [`Accumulate`] the output of a parser into a container, like `Vec` /// /// This stops on [`ErrMode::Backtrack`]. To instead chain an error up, see /// [`cut_err`][crate::combinator::cut_err]. /// -/// # Arguments -/// * `f` The parser to apply. +/// To recognize a series of tokens, [`Accumulate`] into a `()` and then [`Parser::recognize`]. /// /// **Warning:** if the parser passed in accepts empty inputs (like `alpha0` or `digit0`), `many0` will /// return an error, to prevent going into an infinite loop @@ -67,7 +66,8 @@ where }) } -/// Runs the specified parser, gathering the results in a `Vec`. +/// [`Accumulate`] the output of a parser into a container, like `Vec` +/// /// /// This stops on [`ErrMode::Backtrack`] if there is at least one result. To instead chain an error up, /// see [`cut_err`][crate::combinator::cut_err]. @@ -75,6 +75,8 @@ where /// # Arguments /// * `f` The parser to apply. /// +/// To recognize a series of tokens, [`Accumulate`] into a `()` and then [`Parser::recognize`]. +/// /// **Warning:** If the parser passed to `many1` accepts empty inputs /// (like `alpha0` or `digit0`), `many1` will return an error, /// to prevent going into an infinite loop. @@ -149,6 +151,8 @@ where /// /// `f` keeps going so long as `g` produces [`ErrMode::Backtrack`]. To instead chain an error up, see [`cut_err`][crate::combinator::cut_err]. /// +/// To recognize a series of tokens, [`Accumulate`] into a `()` and then [`Parser::recognize`]. +/// /// # Example /// #[cfg_attr(not(feature = "std"), doc = "```ignore")] @@ -506,6 +510,8 @@ where /// * `n` The maximum number of iterations. /// * `f` The parser to apply. /// +/// To recognize a series of tokens, [`Accumulate`] into a `()` and then [`Parser::recognize`]. +/// /// **Warning:** If the parser passed to `many1` accepts empty inputs /// (like `alpha0` or `digit0`), `many1` will return an error, /// to prevent going into an infinite loop. @@ -704,12 +710,14 @@ where } } -/// Runs the embedded parser `count` times, gathering the results in a `Vec` +/// [`Accumulate`] the output of a parser into a container, like `Vec` /// /// # Arguments /// * `f` The parser to apply. /// * `count` How often to apply the parser. /// +/// To recognize a series of tokens, [`Accumulate`] into a `()` and then [`Parser::recognize`]. +/// /// # Example /// #[cfg_attr(not(feature = "std"), doc = "```ignore")]