pub struct SchemaDefinition { /* private fields */ }
Expand description

A GraphQL service’s collective type system capabilities are referred to as that service’s “schema”.

SchemaDefinition: Description? schema Directives? { RootOperationTypeDefinition* }

Detailed documentation can be found in GraphQL spec.

Example

use apollo_encoder::{SchemaDefinition};
use indoc::indoc;

let mut schema_def = SchemaDefinition::new();
schema_def.query("TryingToFindCatQuery".to_string());
schema_def.mutation("MyMutation".to_string());
schema_def.subscription("MySubscription".to_string());

assert_eq!(
   schema_def.to_string(),
   indoc! { r#"
       schema {
         query: TryingToFindCatQuery
         mutation: MyMutation
         subscription: MySubscription
       }
   "#}
);

Implementations§

Create a new instance of SchemaDef.

Set the SchemaDef’s description.

Add a directive.

Set as an extension

Set the schema def’s query type.

Set the schema def’s mutation type.

Set the schema def’s subscription type.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Formats the value using the given formatter. Read more

Create an apollo-encoder node from an apollo-parser one.

Errors

This returns an error if the apollo-parser tree is not valid. The error doesn’t have much context due to TryFrom API constraints: validate the parse tree before using TryFrom if granular errors are important to you.

The type returned in the event of a conversion error.

Create an apollo-encoder node from an apollo-parser one.

Errors

This returns an error if the apollo-parser tree is not valid. The error doesn’t have much context due to TryFrom API constraints: validate the parse tree before using TryFrom if granular errors are important to you.

The type returned in the event of a conversion error.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.