Skip to content

Commit 778606c

Browse files
committed
Fix bad merge [skip ci]
1 parent e344f1c commit 778606c

File tree

14 files changed

+55
-74
lines changed

14 files changed

+55
-74
lines changed

examples/warp_async/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ reqwest = "0.9.19"
1616
juniper_codegen = { git = "https://github.com/graphql-rust/juniper", branch = "async-await", features = ["async"] }
1717
juniper = { git = "https://github.com/graphql-rust/juniper", branch = "async-await", features = ["async"] }
1818
juniper_warp = { git = "https://github.com/graphql-rust/juniper", branch = "async-await", features = ["async"] }
19+

examples/warp_async/src/main.rs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
//! This example demonstrates async/await usage with warp.
33
//! NOTE: this uses tokio 0.1 , not the alpha tokio 0.2.
44
5-
use juniper::{EmptyMutation, FieldError, RootNode};
5+
use juniper::{EmptyMutation, RootNode, FieldError};
66
use warp::{http::Response, Filter};
77

88
#[derive(Clone)]
9-
struct Context {}
9+
struct Context {
10+
11+
}
1012
impl juniper::Context for Context {}
1113

1214
#[derive(juniper::GraphQLEnum, Clone, Copy)]
@@ -46,19 +48,18 @@ struct Query;
4648
#[juniper::object(Context = Context)]
4749
impl Query {
4850
async fn users() -> Vec<User> {
49-
vec![User {
50-
id: 1,
51-
kind: UserKind::Admin,
52-
name: "user1".into(),
53-
}]
51+
vec![
52+
User{
53+
id: 1,
54+
kind: UserKind::Admin,
55+
name: "user1".into(),
56+
},
57+
]
5458
}
5559

5660
/// Fetch a URL and return the response body text.
5761
async fn request(url: String) -> Result<String, FieldError> {
58-
use futures::{
59-
compat::{Future01CompatExt, Stream01CompatExt},
60-
stream::TryStreamExt,
61-
};
62+
use futures::{ compat::{Stream01CompatExt, Future01CompatExt}, stream::TryStreamExt};
6263

6364
let res = reqwest::r#async::Client::new()
6465
.get(&url)
@@ -94,7 +95,7 @@ fn main() {
9495

9596
log::info!("Listening on 127.0.0.1:8080");
9697

97-
let state = warp::any().map(move || Context {});
98+
let state = warp::any().map(move || Context{} );
9899
let graphql_filter = juniper_warp::make_graphql_filter_async(schema(), state.boxed());
99100

100101
warp::serve(
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11

2+
3+
4+

juniper/src/lib.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@ mod executor_tests;
151151
pub use crate::util::to_camel_case;
152152

153153
use crate::{
154-
executor::{execute_validated_query, execute_validated_query_async},
155154
introspection::{INTROSPECTION_QUERY, INTROSPECTION_QUERY_WITHOUT_DESCRIPTIONS},
156155
parser::{parse_document_source, ParseError, Spanning},
157156
validation::{validate_input_values, visit_all_rules, ValidatorContext},
@@ -228,7 +227,7 @@ where
228227
}
229228
}
230229

231-
execute_validated_query(document, operation_name, root_node, variables, context)
230+
executor::execute_validated_query(document, operation_name, root_node, variables, context)
232231
}
233232

234233
/// Execute a query in a provided schema
@@ -268,7 +267,7 @@ where
268267
}
269268
}
270269

271-
execute_validated_query_async(document, operation_name, root_node, variables, context)
270+
executor::execute_validated_query_async(document, operation_name, root_node, variables, context)
272271
.await
273272
}
274273

juniper/src/macros/common.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ macro_rules! __juniper_impl_trait {
77
}
88
) => {
99
impl<$($other,)*> $crate::$impl_trait<$crate::DefaultScalarValue> for $name {
10-
$($body)+
10+
$($body)*
1111
}
1212
};
1313
(
@@ -26,7 +26,7 @@ macro_rules! __juniper_impl_trait {
2626

2727
(
2828
impl< <$generic:tt $(: $bound: tt)*> $(, $other: tt)* > $impl_trait:tt for $name:ty {
29-
$($body:tt)+
29+
$($body:tt)*
3030
}
3131
) => {
3232
impl<$($other,)* $generic $(: $bound)*> $crate::$impl_trait<$generic> for $name
@@ -50,17 +50,17 @@ macro_rules! __juniper_impl_trait {
5050
$generic: $crate::ScalarValue,
5151
for<'__b> &'__b $generic: $crate::ScalarRefValue<'__b>,
5252
{
53-
$($body)+
53+
$($body)*
5454
}
5555
};
5656

5757
(
5858
impl<$scalar:ty $(, $other: tt )*> $impl_trait:tt for $name:ty {
59-
$($body:tt)+
59+
$($body:tt)*
6060
}
6161
) => {
6262
impl<$($other, )*> $crate::$impl_trait<$scalar> for $name {
63-
$($body)+
63+
$($body)*
6464
}
6565
};
6666
(

juniper/src/macros/tests/field.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,16 +95,13 @@ impl Root {
9595
Ok(0)
9696
}
9797

98-
/*
99-
* FIXME: make this work again
10098
fn with_return() -> i32 {
10199
return 0;
102100
}
103101

104102
fn with_return_field_result() -> FieldResult<i32> {
105103
return Ok(0);
106104
}
107-
*/
108105
}
109106

110107
graphql_interface!(Interface: () |&self| {

juniper/src/macros/tests/union.rs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
use std::marker::PhantomData;
2-
3-
use crate::{
4-
ast::InputValue,
5-
schema::model::RootNode,
6-
types::scalars::EmptyMutation,
7-
value::{DefaultScalarValue, Object, Value},
8-
};
9-
101
/*
112
123
Syntax to validate:
@@ -44,16 +35,6 @@ enum WithGenerics<T> {
4435
enum DescriptionFirst {
4536
Concrete(Concrete),
4637
}
47-
enum ResolversFirst {
48-
Concrete(Concrete),
49-
}
50-
51-
enum CommasWithTrailing {
52-
Concrete(Concrete),
53-
}
54-
enum ResolversWithTrailingComma {
55-
Concrete(Concrete),
56-
}
5738

5839
struct Root;
5940

juniper/src/schema/schema.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,13 @@ where
9898
) -> ExecutionResult<S> {
9999
use futures::future::{ready, FutureExt};
100100
match field_name {
101-
"__schema" | "__type" => self.resolve_field(info, field_name, arguments, executor),
102-
_ => {
103-
self.query_type
104-
.resolve_field_async(info, field_name, arguments, executor)
105-
.await
101+
"__schema" | "__type" => {
102+
let v = self.resolve_field(info, field_name, arguments, executor);
103+
Box::pin(ready(v))
106104
}
105+
_ => self
106+
.query_type
107+
.resolve_field_async(info, field_name, arguments, executor),
107108
}
108109
}
109110
}

juniper/src/tests/introspection_tests.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,6 @@ fn test_introspection_possible_types() {
234234
assert_eq!(possible_types, vec!["Human", "Droid"].into_iter().collect());
235235
}
236236

237-
/*
238-
* FIXME: make this work again
239237
#[test]
240238
fn test_builtin_introspection_query() {
241239
let database = Database::new();
@@ -258,4 +256,3 @@ fn test_builtin_introspection_query_without_descriptions() {
258256

259257
assert_eq!(result, (expected, vec![]));
260258
}
261-
*/

juniper/src/types/async_await.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
use crate::{
22
ast::{Directive, FromInputValue, InputValue, Selection},
3+
value::{Object, ScalarRefValue, ScalarValue, Value},
4+
};
5+
6+
use crate::{
37
executor::{ExecutionResult, Executor},
48
parser::Spanning,
5-
value::{Object, ScalarRefValue, ScalarValue, Value},
6-
BoxFuture,
79
};
810

11+
use crate::BoxFuture;
12+
913
use super::base::{is_excluded, merge_key_into, Arguments, GraphQLType};
1014

1115
#[async_trait::async_trait]

0 commit comments

Comments
 (0)