fix tests on stable

This commit is contained in:
Oliver Schneider
2017-01-12 16:06:26 +01:00
parent dced4416a7
commit b860d3cb1f
3 changed files with 51 additions and 40 deletions
+3 -1
View File
@@ -70,9 +70,11 @@ use super::{
Error,
Serialize,
Serializer,
IteratorSerializer,
};
#[cfg(feature = "unstable")]
use super::IteratorSerializer;
///////////////////////////////////////////////////////////////////////////////
macro_rules! impl_visit {
+4
View File
@@ -18,7 +18,9 @@ use error;
#[cfg(all(feature = "collections", not(feature = "std")))]
use collections::String;
#[cfg(feature = "unstable")]
use core::marker::PhantomData;
#[cfg(feature = "unstable")]
use core::cell::RefCell;
pub mod impls;
@@ -418,12 +420,14 @@ pub trait Serializer {
/// A wrapper type for iterators that implements `Serialize` for iterators whose items implement
/// `Serialize`. Don't use multiple times. Create new versions of this with the `iterator` function
/// every time you want to serialize an iterator.
#[cfg(feature = "unstable")]
pub struct IteratorSerializer<I>(RefCell<Option<I>>)
where <I as Iterator>::Item: Serialize,
I: Iterator;
/// Creates a temporary type that can be passed to any function expecting a `Serialize` and will
/// serialize the given iterator as a sequence
#[cfg(feature = "unstable")]
pub fn iterator<I>(iter: I) -> IteratorSerializer<I>
where <I as Iterator>::Item: Serialize,
I: Iterator