Document the punctuated parsers
diff --git a/src/punctuated.rs b/src/punctuated.rs
index 1794fc0..5acb21d 100644
--- a/src/punctuated.rs
+++ b/src/punctuated.rs
@@ -243,6 +243,11 @@
}
}
+ /// Parses zero or more occurrences of `T` separated by punctuation of type
+ /// `P`, with optional trailing punctuation.
+ ///
+ /// Parsing continues until the end of this parse stream. The entire content
+ /// of this parse stream must consist of `T` and `P`.
#[cfg(feature = "parsing")]
pub fn parse_terminated(input: ParseStream) -> Result<Self>
where
@@ -252,6 +257,14 @@
Self::parse_terminated_with(input, T::parse)
}
+ /// Parses zero or more occurrences of `T` using the given parse function,
+ /// separated by punctuation of type `P`, with optional trailing
+ /// punctuation.
+ ///
+ /// Like [`parse_terminated`], the entire content of this stream is expected
+ /// to be parsed.
+ ///
+ /// [`parse_terminated`]: #method.parse_terminated
#[cfg(feature = "parsing")]
pub fn parse_terminated_with(
input: ParseStream,
@@ -278,6 +291,13 @@
Ok(punctuated)
}
+ /// Parses one or more occurrences of `T` separated by punctuation of type
+ /// `P`, not accepting trailing punctuation.
+ ///
+ /// Parsing continues as long as punctuation `P` is present at the head of
+ /// the stream. This method returns upon parsing a `T` and observing that it
+ /// is not followed by a `P`, even if there are remaining tokens in the
+ /// stream.
#[cfg(feature = "parsing")]
pub fn parse_separated_nonempty(input: ParseStream) -> Result<Self>
where
@@ -287,6 +307,14 @@
Self::parse_separated_nonempty_with(input, T::parse)
}
+ /// Parses one or more occurrences of `T` using the given parse function,
+ /// separated by punctuation of type `P`, not accepting trailing
+ /// punctuation.
+ ///
+ /// Like [`parse_separated_nonempty`], may complete early without parsing
+ /// the entire content of this stream.
+ ///
+ /// [`parse_separated_nonempty`]: #method.parse_separated_nonempty
#[cfg(feature = "parsing")]
pub fn parse_separated_nonempty_with(
input: ParseStream,