diff --git a/examples/warp_async/Cargo.toml b/examples/warp_async/Cargo.toml index 1891ad97..c33445e8 100644 --- a/examples/warp_async/Cargo.toml +++ b/examples/warp_async/Cargo.toml @@ -7,11 +7,13 @@ edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -juniper = { git = "https://github.com/graphql-rust/juniper", branch = "async-await", features = ["async"] } -juniper_warp = { git = "https://github.com/graphql-rust/juniper", branch = "async-await", features = ["async"] } log = "0.4.8" env_logger = "0.6.2" warp = "0.1.19" futures-preview = { version = "0.3.0-alpha.18", features = ["nightly", "async-await", "compat"] } reqwest = "0.9.19" +juniper_codegen = { git = "https://github.com/graphql-rust/juniper", branch = "async-await", features = ["async"] } +juniper = { git = "https://github.com/graphql-rust/juniper", branch = "async-await", features = ["async"] } +juniper_warp = { git = "https://github.com/graphql-rust/juniper", branch = "async-await", features = ["async"] } + diff --git a/examples/warp_async/src/main.rs b/examples/warp_async/src/main.rs index 70112bae..170d743b 100644 --- a/examples/warp_async/src/main.rs +++ b/examples/warp_async/src/main.rs @@ -13,8 +13,16 @@ struct Context { } impl juniper::Context for Context {} +#[derive(juniper::GraphQLEnum, Clone, Copy)] +enum UserKind { + Admin, + User, + Guest, +} + struct User { id: i32, + kind: UserKind, name: String, } @@ -24,6 +32,10 @@ impl User { self.id } + fn kind(&self) -> UserKind { + self.kind + } + fn name(&self) -> &str { &self.name } @@ -41,6 +53,7 @@ impl Query { vec![ User{ id: 1, + kind: UserKind::Admin, name: "user1".into(), }, ] diff --git a/juniper/src/lib.rs b/juniper/src/lib.rs index 95ce987b..a6671054 100644 --- a/juniper/src/lib.rs +++ b/juniper/src/lib.rs @@ -90,6 +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")] #![warn(missing_docs)] + #![cfg_attr(feature = "async", feature(async_await, async_closure))] #[doc(hidden)]