pub struct Schema<Query, Mutation, Subscription>(/* private fields */);
Expand description
GraphQL schema.
Cloning a schema is cheap, so it can be easily shared.
Implementations§
Source§impl<Query, Mutation, Subscription> Schema<Query, Mutation, Subscription>where
Query: ObjectType + 'static,
Mutation: ObjectType + 'static,
Subscription: SubscriptionType + 'static,
impl<Query, Mutation, Subscription> Schema<Query, Mutation, Subscription>where
Query: ObjectType + 'static,
Mutation: ObjectType + 'static,
Subscription: SubscriptionType + 'static,
Sourcepub fn build(
query: Query,
mutation: Mutation,
subscription: Subscription,
) -> SchemaBuilder<Query, Mutation, Subscription>
pub fn build( query: Query, mutation: Mutation, subscription: Subscription, ) -> SchemaBuilder<Query, Mutation, Subscription>
Create a schema builder
The root object for the query and Mutation needs to be specified.
If there is no mutation, you can use EmptyMutation
.
If there is no subscription, you can use EmptySubscription
.
Sourcepub fn new(
query: Query,
mutation: Mutation,
subscription: Subscription,
) -> Schema<Query, Mutation, Subscription>
pub fn new( query: Query, mutation: Mutation, subscription: Subscription, ) -> Schema<Query, Mutation, Subscription>
Create a schema
Sourcepub fn federation_sdl(&self) -> String
pub fn federation_sdl(&self) -> String
Returns Federation SDL(Schema Definition Language) of this schema.
Sourcepub fn names(&self) -> Vec<String>
pub fn names(&self) -> Vec<String>
Get all names in this schema
Maybe you want to serialize a custom binary protocol. In order to minimize message size, a dictionary is usually used to compress type names, field names, directive names, and parameter names. This function gets all the names, so you can create this dictionary.
Sourcepub async fn execute_batch(&self, batch_request: BatchRequest) -> BatchResponse
pub async fn execute_batch(&self, batch_request: BatchRequest) -> BatchResponse
Execute a GraphQL batch query.
Trait Implementations§
Source§impl<Query, Mutation, Subscription> Default for Schema<Query, Mutation, Subscription>where
Query: Default + ObjectType + 'static,
Mutation: Default + ObjectType + 'static,
Subscription: Default + SubscriptionType + 'static,
impl<Query, Mutation, Subscription> Default for Schema<Query, Mutation, Subscription>where
Query: Default + ObjectType + 'static,
Mutation: Default + ObjectType + 'static,
Subscription: Default + SubscriptionType + 'static,
Auto Trait Implementations§
impl<Query, Mutation, Subscription> Freeze for Schema<Query, Mutation, Subscription>
impl<Query, Mutation, Subscription> !RefUnwindSafe for Schema<Query, Mutation, Subscription>
impl<Query, Mutation, Subscription> Send for Schema<Query, Mutation, Subscription>
impl<Query, Mutation, Subscription> Sync for Schema<Query, Mutation, Subscription>
impl<Query, Mutation, Subscription> Unpin for Schema<Query, Mutation, Subscription>
impl<Query, Mutation, Subscription> !UnwindSafe for Schema<Query, Mutation, Subscription>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more