add example of fold_many1
@@ -779,6 +779,29 @@ where
/// * `init` The initial value.
/// * `g` The function that combines a result of `f` with
/// the current accumulator.
+/// ```rust
+/// # #[macro_use] extern crate nom;
+/// # use nom::{Err, error::ErrorKind, Needed};
+/// use nom::multi::fold_many1;
+/// use nom::bytes::complete::tag;
+/// # fn main() {
+/// let combiner = |mut acc: Vec<_>, item| {
+/// acc.push(item);
+/// acc
+/// };
+/// let embedded_parser = |s: &'static str| {
+/// tag::<_, _, (_, ErrorKind)>("abc")(s)
+/// };
+/// let parser = |s: &'static str| {
+/// fold_many1::<_, _, (_, ErrorKind), _, _, _>(embedded_parser, Vec::new(), combiner)(s)
+/// };
+///
+/// assert_eq!(parser("abcabc"), Ok(("", vec!["abc", "abc"])));
+/// assert_eq!(parser("abc123"), Ok(("123", vec!["abc"])));
+/// assert_eq!(parser("123123"), Err(Err::Error(("123123", ErrorKind::Many1))));
+/// assert_eq!(parser(""), Err(Err::Error(("", ErrorKind::Many1))));
+/// # }
+/// ```
//FIXME: streaming
pub fn fold_many1<I, O, E, F, G, R>(f: F, init: R, g: G) -> impl Fn(I) -> IResult<I, R, E>
where
