thegraph: Implement From<Vec<(&str, Value)>> for Entity
use graphql_parser::query;
use std::collections::{BTreeMap, HashMap};
+use std::iter::FromIterator;
use std::ops::{Deref, DerefMut};
/// An entity attribute name is represented as a string.
@@ -126,3 +127,11 @@ impl From<HashMap<Attribute, Value>> for Entity {
Entity(m)
}
}
+
+impl<'a> From<Vec<(&'a str, Value)>> for Entity {
+ fn from(entries: Vec<(&'a str, Value)>) -> Entity {
+ Entity::from(HashMap::from_iter(
+ entries.into_iter().map(|(k, v)| (String::from(k), v)),
+ ))
+ }
+}
