Upgrade futures-preview, tokio crates and remove unnecessary 'async_await' feature (#436)
This commit is contained in:
parent
045c1870ef
commit
8d33e8db12
12 changed files with 23 additions and 25 deletions
|
@ -10,7 +10,7 @@ edition = "2018"
|
||||||
log = "0.4.8"
|
log = "0.4.8"
|
||||||
env_logger = "0.6.2"
|
env_logger = "0.6.2"
|
||||||
warp = "0.1.19"
|
warp = "0.1.19"
|
||||||
futures-preview = { version = "0.3.0-alpha.18", features = ["nightly", "async-await", "compat"] }
|
futures-preview = { version = "0.3.0-alpha.19", features = ["async-await", "compat"] }
|
||||||
reqwest = "0.9.19"
|
reqwest = "0.9.19"
|
||||||
|
|
||||||
juniper_codegen = { git = "https://github.com/graphql-rust/juniper", branch = "async-await", features = ["async"] }
|
juniper_codegen = { git = "https://github.com/graphql-rust/juniper", branch = "async-await", features = ["async"] }
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
//! This example demonstrates async/await usage with warp.
|
//! This example demonstrates async/await usage with warp.
|
||||||
//! NOTE: this uses tokio 0.1 , not the alpha tokio 0.2.
|
//! NOTE: this uses tokio 0.1 , not the alpha tokio 0.2.
|
||||||
|
|
||||||
#![feature(async_await, async_closure)]
|
#![feature(async_closure)]
|
||||||
|
|
||||||
use juniper::{EmptyMutation, RootNode, FieldError};
|
use juniper::{EmptyMutation, RootNode, FieldError};
|
||||||
use warp::{http::Response, Filter};
|
use warp::{http::Response, Filter};
|
||||||
|
|
|
@ -8,5 +8,5 @@ edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
juniper = { path = "../../juniper", features = ["async"] }
|
juniper = { path = "../../juniper", features = ["async"] }
|
||||||
futures-preview = "0.3.0-alpha.18"
|
futures-preview = "=0.3.0-alpha.19"
|
||||||
tokio = "0.2.0-alpha.2"
|
tokio = "=0.2.0-alpha.6"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#![feature(async_await, async_closure)]
|
#![feature(async_closure)]
|
||||||
|
|
||||||
use juniper::{graphql_value, RootNode, Value};
|
use juniper::{graphql_value, RootNode, Value};
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ impl User {
|
||||||
|
|
||||||
async fn delayed() -> bool {
|
async fn delayed() -> bool {
|
||||||
let when = tokio::clock::now() + std::time::Duration::from_millis(100);
|
let when = tokio::clock::now() + std::time::Duration::from_millis(100);
|
||||||
tokio::timer::Delay::new(when).await;
|
tokio::timer::delay(when).await;
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ impl Query {
|
||||||
|
|
||||||
async fn delayed() -> bool {
|
async fn delayed() -> bool {
|
||||||
let when = tokio::clock::now() + std::time::Duration::from_millis(100);
|
let when = tokio::clock::now() + std::time::Duration::from_millis(100);
|
||||||
tokio::timer::Delay::new(when).await;
|
tokio::timer::delay(when).await;
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,9 +45,9 @@ serde_json = { version="1.0.2", optional = true }
|
||||||
url = { version = "2", optional = true }
|
url = { version = "2", optional = true }
|
||||||
uuid = { version = "0.7", optional = true }
|
uuid = { version = "0.7", optional = true }
|
||||||
|
|
||||||
futures-preview = { version = "0.3.0-alpha.18", optional = true, features = ["nightly", "async-await"] }
|
futures-preview = { version = "=0.3.0-alpha.19", optional = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
bencher = "0.1.2"
|
bencher = "0.1.2"
|
||||||
serde_json = { version = "1.0.2" }
|
serde_json = { version = "1.0.2" }
|
||||||
tokio = "0.2.0-alpha.2"
|
tokio = "=0.2.0-alpha.6"
|
||||||
|
|
|
@ -90,7 +90,7 @@ Juniper has not reached 1.0 yet, thus some API instability should be expected.
|
||||||
*/
|
*/
|
||||||
#![doc(html_root_url = "https://docs.rs/juniper/0.14.0")]
|
#![doc(html_root_url = "https://docs.rs/juniper/0.14.0")]
|
||||||
#![warn(missing_docs)]
|
#![warn(missing_docs)]
|
||||||
#![cfg_attr(feature = "async", feature(async_await, async_closure))]
|
#![cfg_attr(feature = "async", feature(async_closure))]
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub extern crate serde;
|
pub extern crate serde;
|
||||||
|
|
|
@ -12,8 +12,8 @@ harness = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
juniper = { path = "../juniper", features = ["async"] }
|
juniper = { path = "../juniper", features = ["async"] }
|
||||||
futures-preview = "0.3.0-alpha.18"
|
futures-preview = "=0.3.0-alpha.19"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
criterion = "0.2.11"
|
criterion = "0.2.11"
|
||||||
tokio = "0.2.0-alpha.2"
|
tokio = "=0.2.0-alpha.6"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#![feature(async_await, async_closure)]
|
#![feature(async_closure)]
|
||||||
|
|
||||||
use juniper::{
|
use juniper::{
|
||||||
object, DefaultScalarValue, ExecutionError, FieldError, GraphQLEnum, Value, Variables,
|
object, DefaultScalarValue, ExecutionError, FieldError, GraphQLEnum, Value, Variables,
|
||||||
|
|
|
@ -20,8 +20,9 @@ serde_json = { version = "1.0.2" }
|
||||||
serde_derive = { version = "1.0.2" }
|
serde_derive = { version = "1.0.2" }
|
||||||
juniper = { version = "0.14.0", default-features = false, path = "../juniper"}
|
juniper = { version = "0.14.0", default-features = false, path = "../juniper"}
|
||||||
|
|
||||||
futures03 = { version = "0.3.0-alpha.18", package = "futures-preview", features = ["compat"] }
|
futures03 = { version = "=0.3.0-alpha.19", package = "futures-preview", features = ["compat"] }
|
||||||
rocket = { git = "https://github.com/SergioBenitez/Rocket", branch = "async" }
|
rocket = { git = "https://github.com/SergioBenitez/Rocket", branch = "async" }
|
||||||
|
tokio = "=0.2.0-alpha.6"
|
||||||
|
|
||||||
[dev-dependencies.juniper]
|
[dev-dependencies.juniper]
|
||||||
version = "0.14.0"
|
version = "0.14.0"
|
||||||
|
|
|
@ -38,18 +38,15 @@ Check the LICENSE file for details.
|
||||||
|
|
||||||
#![doc(html_root_url = "https://docs.rs/juniper_rocket/0.2.0")]
|
#![doc(html_root_url = "https://docs.rs/juniper_rocket/0.2.0")]
|
||||||
#![feature(decl_macro, proc_macro_hygiene)]
|
#![feature(decl_macro, proc_macro_hygiene)]
|
||||||
#![cfg_attr(feature = "async", feature(async_await, async_closure))]
|
#![cfg_attr(feature = "async", feature(async_closure))]
|
||||||
|
|
||||||
use std::{
|
use std::{error::Error, io::Cursor};
|
||||||
error::Error,
|
|
||||||
io::{Cursor, Read},
|
|
||||||
};
|
|
||||||
|
|
||||||
use rocket::{
|
use rocket::{
|
||||||
data::{FromDataSimple, Outcome as FromDataOutcome},
|
data::{FromDataFuture, FromDataSimple},
|
||||||
http::{ContentType, RawStr, Status},
|
http::{ContentType, RawStr, Status},
|
||||||
request::{FormItems, FromForm, FromFormValue},
|
request::{FormItems, FromForm, FromFormValue},
|
||||||
response::{content, Responder, Response},
|
response::{content, Responder, Response, ResultFuture},
|
||||||
Data,
|
Data,
|
||||||
Outcome::{Failure, Forward, Success},
|
Outcome::{Failure, Forward, Success},
|
||||||
Request,
|
Request,
|
||||||
|
@ -400,8 +397,8 @@ where
|
||||||
type Error = String;
|
type Error = String;
|
||||||
|
|
||||||
fn from_data(request: &Request, data: Data) -> FromDataFuture<'static, Self, Self::Error> {
|
fn from_data(request: &Request, data: Data) -> FromDataFuture<'static, Self, Self::Error> {
|
||||||
use futures03::io::AsyncReadExt;
|
use tokio::io::AsyncReadExt as _;
|
||||||
use rocket::AsyncReadExt as _;
|
|
||||||
if !request.content_type().map_or(false, |ct| ct.is_json()) {
|
if !request.content_type().map_or(false, |ct| ct.is_json()) {
|
||||||
return Box::pin(async move { Forward(data) });
|
return Box::pin(async move { Forward(data) });
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ futures = "0.1.23"
|
||||||
serde = "1.0.75"
|
serde = "1.0.75"
|
||||||
tokio-threadpool = "0.1.7"
|
tokio-threadpool = "0.1.7"
|
||||||
|
|
||||||
futures03 = { version = "0.3.0-alpha.18", optional = true, package = "futures-preview", features = ["compat"] }
|
futures03 = { version = "=0.3.0-alpha.19", optional = true, package = "futures-preview", features = ["compat"] }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
juniper = { version = "0.14.0", path = "../juniper", features = ["expose-test-schema", "serde_json"] }
|
juniper = { version = "0.14.0", path = "../juniper", features = ["expose-test-schema", "serde_json"] }
|
||||||
|
|
|
@ -39,7 +39,7 @@ Check the LICENSE file for details.
|
||||||
#![deny(missing_docs)]
|
#![deny(missing_docs)]
|
||||||
#![deny(warnings)]
|
#![deny(warnings)]
|
||||||
#![doc(html_root_url = "https://docs.rs/juniper_warp/0.2.0")]
|
#![doc(html_root_url = "https://docs.rs/juniper_warp/0.2.0")]
|
||||||
#![cfg_attr(feature = "async", feature(async_await, async_closure))]
|
#![cfg_attr(feature = "async", feature(async_closure))]
|
||||||
|
|
||||||
use futures::{future::poll_fn, Future};
|
use futures::{future::poll_fn, Future};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
|
Loading…
Reference in a new issue