From f72f808be31e7488cf853d09e08c89cb3723d090 Mon Sep 17 00:00:00 2001 From: Christoph Herzog <chris@theduke.at> Date: Tue, 7 May 2019 10:56:33 +0200 Subject: [PATCH] (warp) impl_object refactor --- juniper_warp/src/lib.rs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/juniper_warp/src/lib.rs b/juniper_warp/src/lib.rs index 458fb42e..9a458d78 100644 --- a/juniper_warp/src/lib.rs +++ b/juniper_warp/src/lib.rs @@ -134,13 +134,18 @@ where /// /// struct QueryRoot; /// -/// juniper::graphql_object! (QueryRoot: ExampleContext |&self| { -/// field say_hello(&executor) -> String { -/// let context = executor.context(); -/// -/// format!("good morning {}, the app state is {:?}", context.1, context.0) +/// #[juniper::impl_object( +/// Context = ExampleContext +/// )] +/// impl QueryRoot { +/// fn say_hello(context: &ExampleContext) -> String { +/// format!( +/// "good morning {}, the app state is {:?}", +/// context.1, +/// context.0 +/// ) /// } -/// }); +/// } /// /// let schema = RootNode::new(QueryRoot, EmptyMutation::new()); ///