Skip to content

Remove Sync Code #667

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
136 changes: 0 additions & 136 deletions benches/bench.rs

This file was deleted.

2 changes: 1 addition & 1 deletion docs/book/content/advanced/dataloaders.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ impl Cult {
// your resolvers

// To call the dataloader
pub async fn cult_by_id(ctx: &Context, id: i32) -> Cult {
async fn cult_by_id(ctx: &Context, id: i32) -> Cult {
ctx.cult_loader.load(id).await
}
}
Expand Down
2 changes: 1 addition & 1 deletion docs/book/content/advanced/introspection.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ struct Query;
Context = Context,
)]
impl Query {
fn example(id: String) -> FieldResult<Example> {
async fn example(id: String) -> FieldResult<Example> {
unimplemented!()
}
}
Expand Down
4 changes: 2 additions & 2 deletions docs/book/content/advanced/non_struct_objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ enum SignUpResult {

#[juniper::graphql_object]
impl SignUpResult {
fn user(&self) -> Option<&User> {
async fn user(&self) -> Option<&User> {
match *self {
SignUpResult::Ok(ref user) => Some(user),
SignUpResult::Error(_) => None,
}
}

fn error(&self) -> Option<&Vec<ValidationError>> {
async fn error(&self) -> Option<&Vec<ValidationError>> {
match *self {
SignUpResult::Ok(_) => None,
SignUpResult::Error(ref errors) => Some(errors)
Expand Down
8 changes: 4 additions & 4 deletions docs/book/content/advanced/objects_and_generics.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ struct MutationResult<T>(Result<T, Vec<ValidationError>>);
name = "UserResult",
)]
impl MutationResult<User> {
fn user(&self) -> Option<&User> {
async fn user(&self) -> Option<&User> {
self.0.as_ref().ok()
}

fn error(&self) -> Option<&Vec<ValidationError>> {
async fn error(&self) -> Option<&Vec<ValidationError>> {
self.0.as_ref().err()
}
}
Expand All @@ -42,11 +42,11 @@ impl MutationResult<User> {
name = "ForumPostResult",
)]
impl MutationResult<ForumPost> {
fn forum_post(&self) -> Option<&ForumPost> {
async fn forum_post(&self) -> Option<&ForumPost> {
self.0.as_ref().ok()
}

fn error(&self) -> Option<&Vec<ValidationError>> {
async fn error(&self) -> Option<&Vec<ValidationError>> {
self.0.as_ref().err()
}
}
Expand Down
4 changes: 2 additions & 2 deletions docs/book/content/advanced/subscriptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ sequentially:
# pub struct Query;
# #[juniper::graphql_object(Context = Database)]
# impl Query {
# fn hello_world() -> &str {
# async fn hello_world() -> &str {
# "Hello World!"
# }
# }
Expand Down Expand Up @@ -106,7 +106,7 @@ resolution of this connection, which means that the subscription failed.
#
# #[juniper::graphql_object(Context = Database)]
# impl Query {
# fn hello_world() -> &str {
# async fn hello_world() -> &str {
# "Hello World!"
# }
# }
Expand Down
6 changes: 3 additions & 3 deletions docs/book/content/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,15 @@ struct Query;
)]
impl Query {

fn apiVersion() -> &str {
async fn apiVersion() -> &str {
"1.0"
}

// Arguments to resolvers can either be simple types or input objects.
// To gain access to the context, we specify a argument
// that is a reference to the Context type.
// Juniper automatically injects the correct context here.
fn human(context: &Context, id: String) -> FieldResult<Human> {
async fn human(context: &Context, id: String) -> FieldResult<Human> {
// Get a db connection.
let connection = context.pool.get_connection()?;
// Execute a db query.
Expand All @@ -110,7 +110,7 @@ struct Mutation;
)]
impl Mutation {

fn createHuman(context: &Context, new_human: NewHuman) -> FieldResult<Human> {
async fn createHuman(context: &Context, new_human: NewHuman) -> FieldResult<Human> {
let db = executor.context().pool.get_connection()?;
let human: Human = db.insert_human(&new_human)?;
Ok(human)
Expand Down
4 changes: 2 additions & 2 deletions docs/book/content/schema/schemas_and_mutations.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct Root;

#[juniper::graphql_object]
impl Root {
fn userWithUsername(username: String) -> FieldResult<Option<User>> {
async fn userWithUsername(username: String) -> FieldResult<Option<User>> {
// Look up user in database...
# unimplemented!()
}
Expand All @@ -51,7 +51,7 @@ struct Mutations;

#[juniper::graphql_object]
impl Mutations {
fn signUpUser(name: String, email: String) -> FieldResult<User> {
async fn signUpUser(name: String, email: String) -> FieldResult<User> {
// Validate inputs and save user in database...
# unimplemented!()
}
Expand Down
4 changes: 2 additions & 2 deletions docs/book/content/servers/iron.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ struct Root;

#[juniper::graphql_object]
impl Root {
fn foo() -> String {
async fn foo() -> String {
"Bar".to_owned()
}
}
Expand Down Expand Up @@ -103,7 +103,7 @@ struct Root;
Context = Context,
)]
impl Root {
field my_addr(context: &Context) -> String {
async fn my_addr(context: &Context) -> String {
format!("Hello, you're coming from {}", context.remote_addr)
}
}
Expand Down
1 change: 0 additions & 1 deletion docs/book/content/types/enums.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ enum StarWarsEpisode {
| description | ✔ | ✔ |
| interfaces | ? | ✘ |
| name | ✔ | ✔ |
| noasync | ✔ | ? |
| scalar | ✘ | ? |
| skip | ? | ✘ |
| ✔: supported | ✘: not supported | ?: not available |
4 changes: 2 additions & 2 deletions docs/book/content/types/input_objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ struct Root;

#[juniper::graphql_object]
impl Root {
fn users_at_location(coordinate: Coordinate, radius: f64) -> Vec<User> {
async fn users_at_location(coordinate: Coordinate, radius: f64) -> Vec<User> {
// Send coordinate to database
// ...
# unimplemented!()
Expand Down Expand Up @@ -47,7 +47,7 @@ struct Root;

#[juniper::graphql_object]
impl Root {
fn users_at_location(coordinate: WorldCoordinate, radius: f64) -> Vec<User> {
async fn users_at_location(coordinate: WorldCoordinate, radius: f64) -> Vec<User> {
// Send coordinate to database
// ...
# unimplemented!()
Expand Down
16 changes: 8 additions & 8 deletions docs/book/content/types/objects/complex_fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ struct Person {

#[juniper::graphql_object]
impl Person {
fn name(&self) -> &str {
async fn name(&self) -> &str {
self.name.as_str()
}

fn age(&self) -> i32 {
async fn age(&self) -> i32 {
self.age
}
}
Expand Down Expand Up @@ -56,7 +56,7 @@ struct House {
#[juniper::graphql_object]
impl House {
// Creates the field inhabitantWithName(name), returning a nullable person
fn inhabitant_with_name(&self, name: String) -> Option<&Person> {
async fn inhabitant_with_name(&self, name: String) -> Option<&Person> {
self.inhabitants.iter().find(|p| p.name == name)
}
}
Expand Down Expand Up @@ -94,27 +94,27 @@ impl Person {
// Or provide a description here.
description = "...",
)]
fn doc_comment(&self) -> &str {
async fn doc_comment(&self) -> &str {
""
}

// Fields can also be renamed if required.
#[graphql(
name = "myCustomFieldName",
)]
fn renamed_field() -> bool {
async fn renamed_field() -> bool {
true
}

// Deprecations also work as you'd expect.
// Both the standard Rust syntax and a custom attribute is accepted.
#[deprecated(note = "...")]
fn deprecated_standard() -> bool {
async fn deprecated_standard() -> bool {
false
}

#[graphql(deprecated = "...")]
fn deprecated_graphql() -> bool {
async fn deprecated_graphql() -> bool {
true
}
}
Expand Down Expand Up @@ -151,7 +151,7 @@ impl Person {
)
)
)]
fn field1(&self, arg1: bool, arg2: i32) -> String {
async fn field1(&self, arg1: bool, arg2: i32) -> String {
format!("{} {}", arg1, arg2)
}
}
Expand Down
Loading