mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-06-14 23:11:01 +00:00
use IntoIterator everywhere
This commit is contained in:
@@ -22,8 +22,6 @@ use collections::String;
|
|||||||
use core::marker::PhantomData;
|
use core::marker::PhantomData;
|
||||||
#[cfg(feature = "unstable")]
|
#[cfg(feature = "unstable")]
|
||||||
use core::cell::RefCell;
|
use core::cell::RefCell;
|
||||||
#[cfg(feature = "unstable")]
|
|
||||||
use core::iter;
|
|
||||||
|
|
||||||
pub mod impls;
|
pub mod impls;
|
||||||
|
|
||||||
@@ -424,15 +422,15 @@ pub trait Serializer {
|
|||||||
/// every time you want to serialize an iterator.
|
/// every time you want to serialize an iterator.
|
||||||
#[cfg(feature = "unstable")]
|
#[cfg(feature = "unstable")]
|
||||||
pub struct Iterator<I>(RefCell<Option<I>>)
|
pub struct Iterator<I>(RefCell<Option<I>>)
|
||||||
where <I as iter::Iterator>::Item: Serialize,
|
where <I as IntoIterator>::Item: Serialize,
|
||||||
I: iter::Iterator;
|
I: IntoIterator;
|
||||||
|
|
||||||
/// Creates a temporary type that can be passed to any function expecting a `Serialize` and will
|
/// Creates a temporary type that can be passed to any function expecting a `Serialize` and will
|
||||||
/// serialize the given iterator as a sequence
|
/// serialize the given iterator as a sequence
|
||||||
#[cfg(feature = "unstable")]
|
#[cfg(feature = "unstable")]
|
||||||
pub fn iterator<I>(iter: I) -> Iterator<I>
|
pub fn iterator<I>(iter: I) -> Iterator<I>
|
||||||
where <I as iter::IntoIterator>::Item: Serialize,
|
where <I as IntoIterator>::Item: Serialize,
|
||||||
I: iter::IntoIterator
|
I: IntoIterator
|
||||||
{
|
{
|
||||||
Iterator(RefCell::new(Some(iter.into_iter())))
|
Iterator(RefCell::new(Some(iter.into_iter())))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user