Switch to indexmap 1.0
`ordermap` changed names to `indexmap` and released a stable 1.0.
This commit is contained in:
parent
254a61c0e0
commit
218654ee97
19 changed files with 54 additions and 54 deletions
|
@ -35,7 +35,7 @@ default = [
|
|||
juniper_codegen = { version = "0.9.2", path = "../juniper_codegen" }
|
||||
|
||||
fnv = "1.0.3"
|
||||
ordermap = { version = "0.2.11", features = ["serde-1"] }
|
||||
indexmap = { version = "1.0.0", features = ["serde-1"] }
|
||||
serde = { version = "1.0.8" }
|
||||
serde_derive = {version="1.0.2" }
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ use std::hash::Hash;
|
|||
use std::vec;
|
||||
use std::slice;
|
||||
|
||||
use ordermap::OrderMap;
|
||||
use indexmap::IndexMap;
|
||||
|
||||
use executor::Variables;
|
||||
use parser::Spanning;
|
||||
|
@ -259,7 +259,7 @@ impl InputValue {
|
|||
///
|
||||
/// Similar to `InputValue::list`, it makes each key and value in the given
|
||||
/// hash map not contain any location information.
|
||||
pub fn object<K>(o: OrderMap<K, InputValue>) -> InputValue
|
||||
pub fn object<K>(o: IndexMap<K, InputValue>) -> InputValue
|
||||
where
|
||||
K: AsRef<str> + Eq + Hash,
|
||||
{
|
||||
|
@ -356,9 +356,9 @@ impl InputValue {
|
|||
|
||||
/// Convert the input value to an unlocated object value.
|
||||
///
|
||||
/// This constructs a new OrderMap that contain references to the keys
|
||||
/// This constructs a new IndexMap that contain references to the keys
|
||||
/// and values in `self`.
|
||||
pub fn to_object_value(&self) -> Option<OrderMap<&str, &InputValue>> {
|
||||
pub fn to_object_value(&self) -> Option<IndexMap<&str, &InputValue>> {
|
||||
match *self {
|
||||
InputValue::Object(ref o) => Some(
|
||||
o.iter()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use ordermap::OrderMap;
|
||||
use indexmap::IndexMap;
|
||||
|
||||
use value::Value;
|
||||
use executor::Variables;
|
||||
|
@ -19,7 +19,7 @@ graphql_object!(TestType: () |&self| {
|
|||
|
||||
fn run_variable_query<F>(query: &str, vars: Variables, f: F)
|
||||
where
|
||||
F: Fn(&OrderMap<String, Value>) -> (),
|
||||
F: Fn(&IndexMap<String, Value>) -> (),
|
||||
{
|
||||
let schema = RootNode::new(TestType, EmptyMutation::<()>::new());
|
||||
|
||||
|
@ -36,7 +36,7 @@ where
|
|||
|
||||
fn run_query<F>(query: &str, f: F)
|
||||
where
|
||||
F: Fn(&OrderMap<String, Value>) -> (),
|
||||
F: Fn(&IndexMap<String, Value>) -> (),
|
||||
{
|
||||
run_variable_query(query, Variables::new(), f);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use ordermap::OrderMap;
|
||||
use indexmap::IndexMap;
|
||||
|
||||
use value::Value;
|
||||
use ast::InputValue;
|
||||
|
@ -30,7 +30,7 @@ graphql_object!(TestType: () |&self| {
|
|||
|
||||
fn run_variable_query<F>(query: &str, vars: Variables, f: F)
|
||||
where
|
||||
F: Fn(&OrderMap<String, Value>) -> (),
|
||||
F: Fn(&IndexMap<String, Value>) -> (),
|
||||
{
|
||||
let schema = RootNode::new(TestType, EmptyMutation::<()>::new());
|
||||
|
||||
|
@ -47,7 +47,7 @@ where
|
|||
|
||||
fn run_query<F>(query: &str, f: F)
|
||||
where
|
||||
F: Fn(&OrderMap<String, Value>) -> (),
|
||||
F: Fn(&IndexMap<String, Value>) -> (),
|
||||
{
|
||||
run_variable_query(query, Variables::new(), f);
|
||||
}
|
||||
|
|
|
@ -367,7 +367,7 @@ mod threads_context_correctly {
|
|||
}
|
||||
|
||||
mod dynamic_context_switching {
|
||||
use ordermap::OrderMap;
|
||||
use indexmap::IndexMap;
|
||||
|
||||
use value::Value;
|
||||
use types::scalars::EmptyMutation;
|
||||
|
@ -382,7 +382,7 @@ mod dynamic_context_switching {
|
|||
}
|
||||
|
||||
struct OuterContext {
|
||||
items: OrderMap<i32, InnerContext>,
|
||||
items: IndexMap<i32, InnerContext>,
|
||||
}
|
||||
|
||||
impl Context for OuterContext {}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use ordermap::OrderMap;
|
||||
use indexmap::IndexMap;
|
||||
|
||||
use executor::Variables;
|
||||
use value::Value;
|
||||
|
@ -72,7 +72,7 @@ graphql_object!(Root: () |&self| {
|
|||
|
||||
fn run_type_info_query<F>(doc: &str, f: F)
|
||||
where
|
||||
F: Fn((&OrderMap<String, Value>, &Vec<Value>)) -> (),
|
||||
F: Fn((&IndexMap<String, Value>, &Vec<Value>)) -> (),
|
||||
{
|
||||
let schema = RootNode::new(Root {}, EmptyMutation::<()>::new());
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use ordermap::OrderMap;
|
||||
use indexmap::IndexMap;
|
||||
|
||||
use ast::{FromInputValue, InputValue};
|
||||
use executor::Variables;
|
||||
|
@ -99,7 +99,7 @@ graphql_object!(Root: () |&self| {
|
|||
|
||||
fn run_type_info_query<F>(doc: &str, f: F)
|
||||
where
|
||||
F: Fn(&OrderMap<String, Value>, &Vec<Value>) -> (),
|
||||
F: Fn(&IndexMap<String, Value>, &Vec<Value>) -> (),
|
||||
{
|
||||
let schema = RootNode::new(Root {}, EmptyMutation::<()>::new());
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use ordermap::OrderMap;
|
||||
use indexmap::IndexMap;
|
||||
|
||||
use value::Value;
|
||||
use ast::InputValue;
|
||||
|
@ -115,7 +115,7 @@ graphql_object!(TestType: () |&self| {
|
|||
|
||||
fn run_variable_query<F>(query: &str, vars: Variables, f: F)
|
||||
where
|
||||
F: Fn(&OrderMap<String, Value>) -> (),
|
||||
F: Fn(&IndexMap<String, Value>) -> (),
|
||||
{
|
||||
let schema = RootNode::new(TestType, EmptyMutation::<()>::new());
|
||||
|
||||
|
@ -132,7 +132,7 @@ where
|
|||
|
||||
fn run_query<F>(query: &str, f: F)
|
||||
where
|
||||
F: Fn(&OrderMap<String, Value>) -> (),
|
||||
F: Fn(&IndexMap<String, Value>) -> (),
|
||||
{
|
||||
run_variable_query(query, Variables::new(), f);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use ordermap::OrderMap;
|
||||
use indexmap::IndexMap;
|
||||
use serde::{de, ser};
|
||||
use serde::ser::SerializeMap;
|
||||
|
||||
|
@ -134,7 +134,7 @@ impl<'de> de::Deserialize<'de> for InputValue {
|
|||
where
|
||||
V: de::MapAccess<'de>,
|
||||
{
|
||||
let mut values: OrderMap<String, InputValue> = OrderMap::new();
|
||||
let mut values: IndexMap<String, InputValue> = IndexMap::new();
|
||||
|
||||
while let Some((key, value)) = try!(visitor.next_entry()) {
|
||||
values.insert(key, value);
|
||||
|
@ -165,7 +165,7 @@ impl ser::Serialize for InputValue {
|
|||
.serialize(serializer),
|
||||
InputValue::Object(ref v) => v.iter()
|
||||
.map(|&(ref k, ref v)| (k.item.clone(), v.item.clone()))
|
||||
.collect::<OrderMap<_, _>>()
|
||||
.collect::<IndexMap<_, _>>()
|
||||
.serialize(serializer),
|
||||
}
|
||||
}
|
||||
|
@ -218,7 +218,7 @@ impl<'a> ser::Serialize for Spanning<ParseError<'a>> {
|
|||
try!(map.serialize_key("message"));
|
||||
try!(map.serialize_value(&message));
|
||||
|
||||
let mut location = OrderMap::new();
|
||||
let mut location = IndexMap::new();
|
||||
location.insert("line".to_owned(), self.start.line() + 1);
|
||||
location.insert("column".to_owned(), self.start.column() + 1);
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ extern crate serde_derive;
|
|||
extern crate serde_json;
|
||||
|
||||
extern crate fnv;
|
||||
extern crate ordermap;
|
||||
extern crate indexmap;
|
||||
|
||||
#[cfg(any(test, feature = "chrono"))]
|
||||
extern crate chrono;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use ordermap::OrderMap;
|
||||
use indexmap::IndexMap;
|
||||
|
||||
use value::Value;
|
||||
use ast::InputValue;
|
||||
|
@ -59,7 +59,7 @@ graphql_interface!(Interface: () |&self| {
|
|||
|
||||
fn run_field_info_query<F>(type_name: &str, field_name: &str, f: F)
|
||||
where
|
||||
F: Fn(&OrderMap<String, Value>) -> (),
|
||||
F: Fn(&IndexMap<String, Value>) -> (),
|
||||
{
|
||||
let doc = r#"
|
||||
query ($typeName: String!) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use ordermap::OrderMap;
|
||||
use indexmap::IndexMap;
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use ast::InputValue;
|
||||
|
@ -130,7 +130,7 @@ graphql_object!(<'a> Root: () as "Root" |&self| {
|
|||
|
||||
fn run_type_info_query<F>(type_name: &str, f: F)
|
||||
where
|
||||
F: Fn(&OrderMap<String, Value>, &Vec<Value>) -> (),
|
||||
F: Fn(&IndexMap<String, Value>, &Vec<Value>) -> (),
|
||||
{
|
||||
let doc = r#"
|
||||
query ($typeName: String!) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use ordermap::OrderMap;
|
||||
use indexmap::IndexMap;
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use ast::InputValue;
|
||||
|
@ -144,7 +144,7 @@ graphql_object!(<'a> Root: InnerContext as "Root" |&self| {
|
|||
|
||||
fn run_type_info_query<F>(type_name: &str, f: F)
|
||||
where
|
||||
F: Fn(&OrderMap<String, Value>, &Vec<Value>) -> (),
|
||||
F: Fn(&IndexMap<String, Value>, &Vec<Value>) -> (),
|
||||
{
|
||||
let doc = r#"
|
||||
query ($typeName: String!) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use ordermap::OrderMap;
|
||||
use indexmap::IndexMap;
|
||||
|
||||
use executor::Variables;
|
||||
use value::Value;
|
||||
|
@ -72,7 +72,7 @@ graphql_object!(Root: () |&self| {
|
|||
|
||||
fn run_type_info_query<F>(doc: &str, f: F)
|
||||
where
|
||||
F: Fn(&OrderMap<String, Value>) -> (),
|
||||
F: Fn(&IndexMap<String, Value>) -> (),
|
||||
{
|
||||
let schema = RootNode::new(Root {}, EmptyMutation::<()>::new());
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use ordermap::OrderMap;
|
||||
use indexmap::IndexMap;
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use ast::InputValue;
|
||||
|
@ -111,7 +111,7 @@ graphql_object!(<'a> Root: () as "Root" |&self| {
|
|||
|
||||
fn run_type_info_query<F>(type_name: &str, f: F)
|
||||
where
|
||||
F: Fn(&OrderMap<String, Value>, &Vec<Value>) -> (),
|
||||
F: Fn(&IndexMap<String, Value>, &Vec<Value>) -> (),
|
||||
{
|
||||
let doc = r#"
|
||||
query ($typeName: String!) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use ordermap::OrderMap;
|
||||
use indexmap::IndexMap;
|
||||
|
||||
use ast::InputValue;
|
||||
use parser::{Lexer, Parser, SourcePosition, Spanning};
|
||||
|
@ -112,7 +112,7 @@ fn input_value_literals() {
|
|||
Spanning::start_end(
|
||||
&SourcePosition::new(0, 0, 0),
|
||||
&SourcePosition::new(2, 0, 2),
|
||||
InputValue::object(OrderMap::<String, InputValue>::new())
|
||||
InputValue::object(IndexMap::<String, InputValue>::new())
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use ordermap::OrderMap;
|
||||
use indexmap::IndexMap;
|
||||
|
||||
use executor::{ExecutionResult, Executor, Registry, Variables};
|
||||
use value::Value;
|
||||
|
@ -13,7 +13,7 @@ pub struct NodeTypeInfo {
|
|||
}
|
||||
|
||||
pub struct Node {
|
||||
attributes: OrderMap<String, String>,
|
||||
attributes: IndexMap<String, String>,
|
||||
}
|
||||
|
||||
impl GraphQLType for Node {
|
||||
|
@ -59,7 +59,7 @@ fn test_node() {
|
|||
attribute_names: vec!["foo".to_string(), "bar".to_string(), "baz".to_string()],
|
||||
};
|
||||
let mut node = Node {
|
||||
attributes: OrderMap::new(),
|
||||
attributes: IndexMap::new(),
|
||||
};
|
||||
node.attributes.insert("foo".to_string(), "1".to_string());
|
||||
node.attributes.insert("bar".to_string(), "2".to_string());
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use ordermap::OrderMap;
|
||||
use ordermap::Entry;
|
||||
use indexmap::IndexMap;
|
||||
use indexmap::map::Entry;
|
||||
|
||||
use ast::{Directive, FromInputValue, InputValue, Selection};
|
||||
use executor::Variables;
|
||||
|
@ -70,17 +70,17 @@ pub enum TypeKind {
|
|||
|
||||
/// Field argument container
|
||||
pub struct Arguments<'a> {
|
||||
args: Option<OrderMap<&'a str, InputValue>>,
|
||||
args: Option<IndexMap<&'a str, InputValue>>,
|
||||
}
|
||||
|
||||
impl<'a> Arguments<'a> {
|
||||
#[doc(hidden)]
|
||||
pub fn new(
|
||||
mut args: Option<OrderMap<&'a str, InputValue>>,
|
||||
mut args: Option<IndexMap<&'a str, InputValue>>,
|
||||
meta_args: &'a Option<Vec<Argument>>,
|
||||
) -> Arguments<'a> {
|
||||
if meta_args.is_some() && args.is_none() {
|
||||
args = Some(OrderMap::new());
|
||||
args = Some(IndexMap::new());
|
||||
}
|
||||
|
||||
if let (&mut Some(ref mut args), &Some(ref meta_args)) = (&mut args, meta_args) {
|
||||
|
@ -310,7 +310,7 @@ pub trait GraphQLType: Sized {
|
|||
executor: &Executor<Self::Context>,
|
||||
) -> Value {
|
||||
if let Some(selection_set) = selection_set {
|
||||
let mut result = OrderMap::new();
|
||||
let mut result = IndexMap::new();
|
||||
if resolve_selection_set_into(self, info, selection_set, executor, &mut result) {
|
||||
Value::object(result)
|
||||
} else {
|
||||
|
@ -327,7 +327,7 @@ fn resolve_selection_set_into<T, CtxT>(
|
|||
info: &T::TypeInfo,
|
||||
selection_set: &[Selection],
|
||||
executor: &Executor<CtxT>,
|
||||
result: &mut OrderMap<String, Value>,
|
||||
result: &mut IndexMap<String, Value>,
|
||||
) -> bool
|
||||
where
|
||||
T: GraphQLType<Context = CtxT>,
|
||||
|
@ -503,7 +503,7 @@ fn is_excluded(directives: &Option<Vec<Spanning<Directive>>>, vars: &Variables)
|
|||
false
|
||||
}
|
||||
|
||||
fn merge_key_into(result: &mut OrderMap<String, Value>, response_name: &str, value: Value) {
|
||||
fn merge_key_into(result: &mut IndexMap<String, Value>, response_name: &str, value: Value) {
|
||||
match result.entry(response_name.to_owned()) {
|
||||
Entry::Occupied(mut e) => {
|
||||
match e.get_mut() {
|
||||
|
@ -535,7 +535,7 @@ fn merge_key_into(result: &mut OrderMap<String, Value>, response_name: &str, val
|
|||
}
|
||||
}
|
||||
|
||||
fn merge_maps(dest: &mut OrderMap<String, Value>, src: OrderMap<String, Value>) {
|
||||
fn merge_maps(dest: &mut IndexMap<String, Value>, src: IndexMap<String, Value>) {
|
||||
for (key, value) in src {
|
||||
if dest.contains_key(&key) {
|
||||
merge_key_into(dest, &key, value);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use ordermap::OrderMap;
|
||||
use indexmap::IndexMap;
|
||||
use std::hash::Hash;
|
||||
|
||||
use parser::Spanning;
|
||||
|
@ -22,7 +22,7 @@ pub enum Value {
|
|||
String(String),
|
||||
Boolean(bool),
|
||||
List(Vec<Value>),
|
||||
Object(OrderMap<String, Value>),
|
||||
Object(IndexMap<String, Value>),
|
||||
}
|
||||
|
||||
impl Value {
|
||||
|
@ -59,7 +59,7 @@ impl Value {
|
|||
}
|
||||
|
||||
/// Construct an object value.
|
||||
pub fn object<K>(o: OrderMap<K, Value>) -> Value
|
||||
pub fn object<K>(o: IndexMap<K, Value>) -> Value
|
||||
where
|
||||
K: Into<String> + Eq + Hash,
|
||||
{
|
||||
|
@ -85,7 +85,7 @@ impl Value {
|
|||
}
|
||||
|
||||
/// View the underlying object value, if present.
|
||||
pub fn as_object_value(&self) -> Option<&OrderMap<String, Value>> {
|
||||
pub fn as_object_value(&self) -> Option<&IndexMap<String, Value>> {
|
||||
match *self {
|
||||
Value::Object(ref o) => Some(o),
|
||||
_ => None,
|
||||
|
@ -93,7 +93,7 @@ impl Value {
|
|||
}
|
||||
|
||||
/// Mutable view into the underlying object value, if present.
|
||||
pub fn as_mut_object_value(&mut self) -> Option<&mut OrderMap<String, Value>> {
|
||||
pub fn as_mut_object_value(&mut self) -> Option<&mut IndexMap<String, Value>> {
|
||||
match *self {
|
||||
Value::Object(ref mut o) => Some(o),
|
||||
_ => None,
|
||||
|
|
Loading…
Reference in a new issue