Trait cynic::QueryFragment

source ·
pub trait QueryFragment: Sized {
    type SchemaType;
    type VariablesFields: QueryVariablesFields;

    const TYPE: Option<&'static str> = None;

    // Required method
    fn query(
        builder: SelectionBuilder<'_, Self::SchemaType, Self::VariablesFields>
    );

    // Provided method
    fn name() -> Option<Cow<'static, str>> { ... }
}
Expand description

Indicates that a type may be used as part of a graphql query.

This will usually be derived, but can be manually implemented if required.

Required Associated Types§

source

type SchemaType

The type in a schema that this QueryFragment represents

source

type VariablesFields: QueryVariablesFields

The variables that are required to execute this QueryFragment

Provided Associated Constants§

source

const TYPE: Option<&'static str> = None

The name of the type in the GraphQL schema

Required Methods§

source

fn query(builder: SelectionBuilder<'_, Self::SchemaType, Self::VariablesFields>)

Adds this fragment to the query being built by builder

Provided Methods§

source

fn name() -> Option<Cow<'static, str>>

The name of this fragment, useful for operations, maybe fragments if we ever support them…

Implementations on Foreign Types§

source§

impl<T> QueryFragment for Vec<T>where T: QueryFragment,

source§

impl<T> QueryFragment for Rc<T>where T: QueryFragment,

source§

impl QueryFragment for bool

source§

impl QueryFragment for String

source§

impl<T> QueryFragment for Option<T>where T: QueryFragment,

source§

impl<T> QueryFragment for Arc<T>where T: QueryFragment,

source§

impl<T> QueryFragment for Box<T>where T: QueryFragment,

Implementors§