make ser::iterator more general by taking IntoIterator

This commit is contained in:
Oliver Schneider 2017-01-12 19:24:35 +01:00 committed by GitHub
parent 110d36fa14
commit 756bff534f

View File

@ -431,8 +431,8 @@ pub struct Iterator<I>(RefCell<Option<I>>)
/// serialize the given iterator as a sequence
#[cfg(feature = "unstable")]
pub fn iterator<I>(iter: I) -> Iterator<I>
where <I as iter::Iterator>::Item: Serialize,
I: iter::Iterator
where <I as iter::IntoIterator>::Item: Serialize,
I: iter::IntoIterator
{
Iterator(RefCell::new(Some(iter)))
Iterator(RefCell::new(Some(iter.into_iter())))
}