Implement FromIterator for value::Map
@@ -2,6 +2,7 @@ use serde::{ser, de};
use std::fmt::{self, Debug};
use value::Value;
use std::hash::Hash;
+use std::iter::FromIterator;
use std::borrow::Borrow;
use std::ops;
@@ -274,6 +275,14 @@ impl de::Deserialize for Map<String, Value> {
}
}
+impl FromIterator<(String, Value)> for Map<String, Value> {
+ fn from_iter<T>(iter: T) -> Self where T: IntoIterator<Item=(String, Value)> {
+ Map {
+ map: FromIterator::from_iter(iter)
+ }
+ }
+}
+
macro_rules! delegate_iterator {
(($name:ident $($generics:tt)*) => $item:ty) => {
impl $($generics)* Iterator for $name $($generics)* {
