remove new fns from combinator structs (#434)

This is not idiomatic.
This commit is contained in:
Carl Lerche
2020-10-18 09:55:19 -07:00
committed by GitHub
parent ced050730c
commit 4724c7e8a0
2 changed files with 3 additions and 4 deletions
+1 -1
View File
@@ -38,7 +38,7 @@ pub struct Chain<T, U> {
impl<T, U> Chain<T, U> { impl<T, U> Chain<T, U> {
/// Creates a new `Chain` sequencing the provided values. /// Creates a new `Chain` sequencing the provided values.
pub fn new(a: T, b: U) -> Chain<T, U> { pub(crate) fn new(a: T, b: U) -> Chain<T, U> {
Chain { a, b } Chain { a, b }
} }
+2 -3
View File
@@ -34,17 +34,16 @@ impl<T> IntoIter<T> {
/// ///
/// ``` /// ```
/// use bytes::Bytes; /// use bytes::Bytes;
/// use bytes::buf::IntoIter;
/// ///
/// let buf = Bytes::from_static(b"abc"); /// let buf = Bytes::from_static(b"abc");
/// let mut iter = IntoIter::new(buf); /// let mut iter = buf.into_iter();
/// ///
/// assert_eq!(iter.next(), Some(b'a')); /// assert_eq!(iter.next(), Some(b'a'));
/// assert_eq!(iter.next(), Some(b'b')); /// assert_eq!(iter.next(), Some(b'b'));
/// assert_eq!(iter.next(), Some(b'c')); /// assert_eq!(iter.next(), Some(b'c'));
/// assert_eq!(iter.next(), None); /// assert_eq!(iter.next(), None);
/// ``` /// ```
pub fn new(inner: T) -> IntoIter<T> { pub(crate) fn new(inner: T) -> IntoIter<T> {
IntoIter { inner } IntoIter { inner }
} }