pub struct Executor<'a, CtxT, S = DefaultScalarValue>where
CtxT: 'a,
S: 'a,{ /* private fields */ }
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
sourceimpl<'a, CtxT, S> Executor<'a, CtxT, S>where
S: ScalarValue,
for<'b> &'b S: ScalarRefValue<'b>,
impl<'a, CtxT, S> Executor<'a, CtxT, S>where
S: ScalarValue,
for<'b> &'b S: ScalarRefValue<'b>,
sourcepub fn resolve_with_ctx<NewCtxT, T>(
&self,
info: &T::TypeInfo,
value: &T
) -> ExecutionResult<S>where
NewCtxT: FromContext<CtxT>,
T: GraphQLType<S, Context = NewCtxT>,
pub fn resolve_with_ctx<NewCtxT, T>(
&self,
info: &T::TypeInfo,
value: &T
) -> ExecutionResult<S>where
NewCtxT: FromContext<CtxT>,
T: GraphQLType<S, Context = NewCtxT>,
Resolve a single arbitrary value, mapping the context to a new type
sourcepub fn resolve<T>(&self, info: &T::TypeInfo, value: &T) -> ExecutionResult<S>where
T: GraphQLType<S, Context = CtxT>,
pub fn resolve<T>(&self, info: &T::TypeInfo, value: &T) -> ExecutionResult<S>where
T: GraphQLType<S, Context = CtxT>,
Resolve a single arbitrary value into an ExecutionResult
sourcepub fn resolve_into_value<T>(&self, info: &T::TypeInfo, value: &T) -> Value<S>where
T: GraphQLType<S, Context = CtxT>,
pub fn resolve_into_value<T>(&self, info: &T::TypeInfo, value: &T) -> Value<S>where
T: GraphQLType<S, Context = CtxT>,
Resolve a single arbitrary value into a return value
If the field fails to resolve, null
will be returned.
sourcepub fn replaced_context<'b, NewCtxT>(
&'b self,
ctx: &'b NewCtxT
) -> Executor<'b, NewCtxT, S>
pub fn replaced_context<'b, NewCtxT>(
&'b self,
ctx: &'b NewCtxT
) -> Executor<'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.
sourcepub fn context(&self) -> &'a CtxT
pub fn context(&self) -> &'a CtxT
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.
sourcepub fn location(&self) -> &SourcePosition
pub fn location(&self) -> &SourcePosition
The current location of the executor
sourcepub fn push_error(&self, error: FieldError<S>)
pub fn push_error(&self, error: FieldError<S>)
Add an error to the execution engine at the current executor location
sourcepub fn push_error_at(&self, error: FieldError<S>, location: SourcePosition)
pub fn push_error_at(&self, error: FieldError<S>, location: SourcePosition)
Add an error to the execution engine at a specific location
sourcepub fn look_ahead(&'a self) -> LookAheadSelection<'a, S>
pub fn look_ahead(&'a self) -> LookAheadSelection<'a, S>
Construct a lookahead selection for the current selection
This allows to see the whole selection and preform operations affecting the childs