Struct juniper::executor::Executor [−][src]
pub struct Executor<'r, 'a, CtxT, S = DefaultScalarValue> where
CtxT: 'a,
S: 'a, { /* fields omitted */ }
Expand description
Query execution engine
The executor helps drive the query execution in a schema. It keeps track of the current field stack, context, variables, and errors.
Implementations
pub async fn resolve_into_stream<'i, 'v, 'res, T: ?Sized>(
&'r self,
info: &'i T::TypeInfo,
value: &'v T
) -> Value<ValuesStream<'res, S>> where
'i: 'res,
'v: 'res,
'a: 'res,
T: GraphQLSubscriptionValue<S, Context = CtxT>,
T::TypeInfo: Sync,
CtxT: Sync,
S: Send + Sync,
pub async fn resolve_into_stream<'i, 'v, 'res, T: ?Sized>(
&'r self,
info: &'i T::TypeInfo,
value: &'v T
) -> Value<ValuesStream<'res, S>> where
'i: 'res,
'v: 'res,
'a: 'res,
T: GraphQLSubscriptionValue<S, Context = CtxT>,
T::TypeInfo: Sync,
CtxT: Sync,
S: Send + Sync,
Resolve a single arbitrary value into a stream of Value
s.
If a field fails to resolve, pushes error to Executor
and returns Value::Null
.
pub async fn subscribe<'s, 't, 'res, T: ?Sized>(
&'r self,
info: &'t T::TypeInfo,
value: &'t T
) -> Result<Value<ValuesStream<'res, S>>, FieldError<S>> where
't: 'res,
'a: 'res,
T: GraphQLSubscriptionValue<S, Context = CtxT>,
T::TypeInfo: Sync,
CtxT: Sync,
S: Send + Sync,
pub async fn subscribe<'s, 't, 'res, T: ?Sized>(
&'r self,
info: &'t T::TypeInfo,
value: &'t T
) -> Result<Value<ValuesStream<'res, S>>, FieldError<S>> where
't: 'res,
'a: 'res,
T: GraphQLSubscriptionValue<S, Context = CtxT>,
T::TypeInfo: Sync,
CtxT: Sync,
S: Send + Sync,
Resolve a single arbitrary value into a stream of Value
s.
Calls resolve_into_stream
on T
.
pub fn resolve_with_ctx<NewCtxT, T: ?Sized>(
&self,
info: &T::TypeInfo,
value: &T
) -> ExecutionResult<S> where
NewCtxT: FromContext<CtxT>,
T: GraphQLValue<S, Context = NewCtxT>,
pub fn resolve_with_ctx<NewCtxT, T: ?Sized>(
&self,
info: &T::TypeInfo,
value: &T
) -> ExecutionResult<S> where
NewCtxT: FromContext<CtxT>,
T: GraphQLValue<S, Context = NewCtxT>,
Resolve a single arbitrary value, mapping the context to a new type
pub fn resolve<T: ?Sized>(
&self,
info: &T::TypeInfo,
value: &T
) -> ExecutionResult<S> where
T: GraphQLValue<S, Context = CtxT>,
pub fn resolve<T: ?Sized>(
&self,
info: &T::TypeInfo,
value: &T
) -> ExecutionResult<S> where
T: GraphQLValue<S, Context = CtxT>,
Resolve a single arbitrary value into an ExecutionResult
pub async fn resolve_async<T: ?Sized>(
&self,
info: &T::TypeInfo,
value: &T
) -> ExecutionResult<S> where
T: GraphQLValueAsync<S, Context = CtxT>,
T::TypeInfo: Sync,
CtxT: Sync,
S: Send + Sync,
pub async fn resolve_async<T: ?Sized>(
&self,
info: &T::TypeInfo,
value: &T
) -> ExecutionResult<S> where
T: GraphQLValueAsync<S, Context = CtxT>,
T::TypeInfo: Sync,
CtxT: Sync,
S: Send + Sync,
Resolve a single arbitrary value into an ExecutionResult
pub async fn resolve_with_ctx_async<NewCtxT, T: ?Sized>(
&self,
info: &T::TypeInfo,
value: &T
) -> ExecutionResult<S> where
T: GraphQLValueAsync<S, Context = NewCtxT>,
T::TypeInfo: Sync,
NewCtxT: FromContext<CtxT> + Sync,
S: Send + Sync,
pub async fn resolve_with_ctx_async<NewCtxT, T: ?Sized>(
&self,
info: &T::TypeInfo,
value: &T
) -> ExecutionResult<S> where
T: GraphQLValueAsync<S, Context = NewCtxT>,
T::TypeInfo: Sync,
NewCtxT: FromContext<CtxT> + Sync,
S: Send + Sync,
Resolve a single arbitrary value, mapping the context to a new type
pub fn resolve_into_value<T>(&self, info: &T::TypeInfo, value: &T) -> Value<S> where
T: GraphQLValue<S, Context = CtxT>,
pub fn resolve_into_value<T>(&self, info: &T::TypeInfo, value: &T) -> Value<S> where
T: GraphQLValue<S, Context = CtxT>,
Resolve a single arbitrary value into a return value
If the field fails to resolve, null
will be returned.
Resolve a single arbitrary value into a return value
If the field fails to resolve, null
will be returned.
pub fn replaced_context<'b, NewCtxT>(
&'b self,
ctx: &'b NewCtxT
) -> Executor<'b, 'b, NewCtxT, S>
pub fn replaced_context<'b, NewCtxT>(
&'b self,
ctx: &'b NewCtxT
) -> Executor<'b, 'b, NewCtxT, S>
Derive a new executor by replacing the context
This can be used to connect different types, e.g. from different Rust libraries, that require different context types.
Access the current context
You usually provide the context when calling the top-level execute
function, or using the context factory in the Iron integration.
The currently executing schema
The current location of the executor
Add an error to the execution engine at the current executor location
Add an error to the execution engine at a specific location
Returns new ExecutionError
at current location
Construct a lookahead selection for the current selection.
This allows seeing the whole selection and perform operations affecting the children.
Create new OwnedExecutor
and clone all current data
(except for errors) there
New empty vector is created for errors
because
existing errors won’t be needed to be accessed by user
in OwnedExecutor as existing errors will be returned in
execute_query
/execute_mutation
/resolve_into_stream
/etc.
Auto Trait Implementations
impl<'r, 'a, CtxT, S> RefUnwindSafe for Executor<'r, 'a, CtxT, S> where
CtxT: RefUnwindSafe,
S: RefUnwindSafe,
impl<'r, 'a, CtxT, S> UnwindSafe for Executor<'r, 'a, CtxT, S> where
CtxT: RefUnwindSafe,
S: RefUnwindSafe,