Struct juniper::RootNode

source ·
pub struct RootNode<'a, QueryT: GraphQLType<S>, MutationT: GraphQLType<S>, SubscriptionT: GraphQLType<S>, S = DefaultScalarValue>where
    S: ScalarValue,
{ /* private fields */ }
Expand description

Root query node of a schema

This brings the mutation, subscription and query types together, and provides the predefined metadata fields.

Implementations§

source§

impl<'a, QueryT, MutationT, SubscriptionT> RootNode<'a, QueryT, MutationT, SubscriptionT, DefaultScalarValue>where
    QueryT: GraphQLType<DefaultScalarValue, TypeInfo = ()>,
    MutationT: GraphQLType<DefaultScalarValue, TypeInfo = ()>,
    SubscriptionT: GraphQLType<DefaultScalarValue, TypeInfo = ()>,

source

pub fn new(
    query: QueryT,
    mutation: MutationT,
    subscription: SubscriptionT
) -> Self

Constructs a new RootNode from query, mutation and subscription nodes, parametrizing it with a DefaultScalarValue.

source§

impl<'a, QueryT, MutationT, SubscriptionT, S> RootNode<'a, QueryT, MutationT, SubscriptionT, S>where
    S: ScalarValue + 'a,
    QueryT: GraphQLType<S, TypeInfo = ()>,
    MutationT: GraphQLType<S, TypeInfo = ()>,
    SubscriptionT: GraphQLType<S, TypeInfo = ()>,

source

pub fn new_with_scalar_value(
    query: QueryT,
    mutation: MutationT,
    subscription: SubscriptionT
) -> Self

Constructs a new RootNode from query, mutation and subscription nodes, parametrizing it with the provided ScalarValue.

source§

impl<'a, S, QueryT, MutationT, SubscriptionT> RootNode<'a, QueryT, MutationT, SubscriptionT, S>where
    QueryT: GraphQLType<S>,
    MutationT: GraphQLType<S>,
    SubscriptionT: GraphQLType<S>,
    S: ScalarValue + 'a,

source

pub fn new_with_info(
    query_obj: QueryT,
    mutation_obj: MutationT,
    subscription_obj: SubscriptionT,
    query_info: QueryT::TypeInfo,
    mutation_info: MutationT::TypeInfo,
    subscription_info: SubscriptionT::TypeInfo
) -> Self

Construct a new root node from query and mutation nodes, while also providing type info objects for the query and mutation types.

source

pub fn as_schema_language(&self) -> String

The schema definition as a String in the GraphQL Schema Language format.

source

pub fn as_parser_document(&'a self) -> Document<'a, &'a str>

The schema definition as a graphql_parser Document.

Trait Implementations§

source§

impl<'a, QueryT: Debug + GraphQLType<S>, MutationT: Debug + GraphQLType<S>, SubscriptionT: Debug + GraphQLType<S>, S> Debug for RootNode<'a, QueryT, MutationT, SubscriptionT, S>where
    S: ScalarValue + Debug,
    QueryT::TypeInfo: Debug,
    MutationT::TypeInfo: Debug,
    SubscriptionT::TypeInfo: Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a, S, QueryT, MutationT, SubscriptionT> GraphQLType<S> for RootNode<'a, QueryT, MutationT, SubscriptionT, S>where
    S: ScalarValue,
    QueryT: GraphQLType<S>,
    MutationT: GraphQLType<S, Context = QueryT::Context>,
    SubscriptionT: GraphQLType<S, Context = QueryT::Context>,

source§

fn name(info: &Self::TypeInfo) -> Option<&str>

Returns name of this GraphQLType to expose. Read more
source§

fn meta<'r>(
    info: &Self::TypeInfo,
    registry: &mut Registry<'r, S>
) -> MetaType<'r, S>where
    S: 'r,

Returns MetaType representing this GraphQLType.
source§

impl<'a, S, QueryT, MutationT, SubscriptionT> GraphQLValue<S> for RootNode<'a, QueryT, MutationT, SubscriptionT, S>where
    S: ScalarValue,
    QueryT: GraphQLType<S>,
    MutationT: GraphQLType<S, Context = QueryT::Context>,
    SubscriptionT: GraphQLType<S, Context = QueryT::Context>,

§

type Context = <QueryT as GraphQLValue<S>>::Context

Context type for this GraphQLValue. Read more
§

type TypeInfo = <QueryT as GraphQLValue<S>>::TypeInfo

Type that may carry additional schema information for this GraphQLValue. Read more
source§

fn type_name<'i>(&self, info: &'i Self::TypeInfo) -> Option<&'i str>

Returns name of the GraphQLType exposed by this GraphQLValue. Read more
source§

fn concrete_type_name(
    &self,
    context: &Self::Context,
    info: &Self::TypeInfo
) -> String

Returns the concrete GraphQLType name for this GraphQLValue being an interface, an union or an object. Read more
source§

fn resolve_field(
    &self,
    info: &Self::TypeInfo,
    field: &str,
    args: &Arguments<'_, S>,
    executor: &Executor<'_, '_, Self::Context, S>
) -> ExecutionResult<S>

Resolves the value of a single field on this GraphQLValue. Read more
source§

fn resolve(
    &self,
    info: &Self::TypeInfo,
    selection_set: Option<&[Selection<'_, S>]>,
    executor: &Executor<'_, '_, Self::Context, S>
) -> ExecutionResult<S>

Resolves the provided selection_set against this GraphQLValue. Read more
source§

fn resolve_into_type(
    &self,
    info: &Self::TypeInfo,
    type_name: &str,
    selection_set: Option<&[Selection<'_, S>]>,
    executor: &Executor<'_, '_, Self::Context, S>
) -> ExecutionResult<S>

Resolves this GraphQLValue (being an interface or an union) into a concrete downstream object type. Read more
source§

impl<'a, S, QueryT, MutationT, SubscriptionT> GraphQLValueAsync<S> for RootNode<'a, QueryT, MutationT, SubscriptionT, S>where
    QueryT: GraphQLTypeAsync<S>,
    QueryT::TypeInfo: Sync,
    QueryT::Context: Sync + 'a,
    MutationT: GraphQLTypeAsync<S, Context = QueryT::Context>,
    MutationT::TypeInfo: Sync,
    SubscriptionT: GraphQLType<S, Context = QueryT::Context> + Sync,
    SubscriptionT::TypeInfo: Sync,
    S: ScalarValue + Send + Sync,

source§

fn resolve_field_async<'b>(
    &'b self,
    info: &'b Self::TypeInfo,
    field_name: &'b str,
    arguments: &'b Arguments<'_, S>,
    executor: &'b Executor<'_, '_, Self::Context, S>
) -> BoxFuture<'b, ExecutionResult<S>>

Resolves the value of a single field on this GraphQLValueAsync. Read more
source§

fn resolve_into_type_async<'a>(
    &'a self,
    info: &'a Self::TypeInfo,
    type_name: &str,
    selection_set: Option<&'a [Selection<'a, S>]>,
    executor: &'a Executor<'a, 'a, Self::Context, S>
) -> BoxFuture<'a, ExecutionResult<S>>

Resolves this GraphQLValueAsync (being an interface or an union) into a concrete downstream object type. Read more
source§

fn resolve_async<'a>(
    &'a self,
    info: &'a Self::TypeInfo,
    selection_set: Option<&'a [Selection<'_, S>]>,
    executor: &'a Executor<'_, '_, Self::Context, S>
) -> BoxFuture<'a, ExecutionResult<S>>

Resolves the provided selection_set against this GraphQLValueAsync. Read more

Auto Trait Implementations§

§

impl<'a, QueryT, MutationT, SubscriptionT, S> RefUnwindSafe for RootNode<'a, QueryT, MutationT, SubscriptionT, S>where
    MutationT: RefUnwindSafe,
    QueryT: RefUnwindSafe,
    S: RefUnwindSafe,
    SubscriptionT: RefUnwindSafe,
    <MutationT as GraphQLValue<S>>::TypeInfo: RefUnwindSafe,
    <QueryT as GraphQLValue<S>>::TypeInfo: RefUnwindSafe,
    <SubscriptionT as GraphQLValue<S>>::TypeInfo: RefUnwindSafe,

§

impl<'a, QueryT, MutationT, SubscriptionT, S> Send for RootNode<'a, QueryT, MutationT, SubscriptionT, S>where
    MutationT: Send,
    QueryT: Send,
    S: Send,
    SubscriptionT: Send,
    <MutationT as GraphQLValue<S>>::TypeInfo: Send,
    <QueryT as GraphQLValue<S>>::TypeInfo: Send,
    <SubscriptionT as GraphQLValue<S>>::TypeInfo: Send,

§

impl<'a, QueryT, MutationT, SubscriptionT, S> Sync for RootNode<'a, QueryT, MutationT, SubscriptionT, S>where
    MutationT: Sync,
    QueryT: Sync,
    S: Sync,
    SubscriptionT: Sync,
    <MutationT as GraphQLValue<S>>::TypeInfo: Sync,
    <QueryT as GraphQLValue<S>>::TypeInfo: Sync,
    <SubscriptionT as GraphQLValue<S>>::TypeInfo: Sync,

§

impl<'a, QueryT, MutationT, SubscriptionT, S> Unpin for RootNode<'a, QueryT, MutationT, SubscriptionT, S>where
    MutationT: Unpin,
    QueryT: Unpin,
    S: Unpin,
    SubscriptionT: Unpin,
    <MutationT as GraphQLValue<S>>::TypeInfo: Unpin,
    <QueryT as GraphQLValue<S>>::TypeInfo: Unpin,
    <SubscriptionT as GraphQLValue<S>>::TypeInfo: Unpin,

§

impl<'a, QueryT, MutationT, SubscriptionT, S> UnwindSafe for RootNode<'a, QueryT, MutationT, SubscriptionT, S>where
    MutationT: UnwindSafe,
    QueryT: UnwindSafe,
    S: UnwindSafe,
    SubscriptionT: UnwindSafe,
    <MutationT as GraphQLValue<S>>::TypeInfo: UnwindSafe,
    <QueryT as GraphQLValue<S>>::TypeInfo: UnwindSafe,
    <SubscriptionT as GraphQLValue<S>>::TypeInfo: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere
    T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere
    T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere
    T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere
    U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere
    U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere
    U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere
    V: MultiLane<T>,

§

fn vzip(self) -> V