pub struct Schema { /* private fields */ }Expand description
Represents a fully typechecked and immutable GraphQL schema.
Implementations§
Source§impl Schema
impl Schema
Sourcepub fn all_directives(&self) -> ReadOnlyMap<'_, String, Directive>
pub fn all_directives(&self) -> ReadOnlyMap<'_, String, Directive>
Returns a map from DirectiveName (String) -> Directive for all
directives (including built-in GraphQL directives) provided by this
Schema.
⚠️ NOTE: In addition to directives defined directly in this
Schemathis map also includes implicitly-defined, built-in directives likeDirective::Deprecated,Directive::Include,Directive::Skip, etc.
Sourcepub fn all_types(&self) -> ReadOnlyMap<'_, String, GraphQLType>
pub fn all_types(&self) -> ReadOnlyMap<'_, String, GraphQLType>
Returns a map from TypeName (String) -> GraphQLType for all
types (including built-in GraphQL types) provided by this Schema.
⚠️ NOTE: In addition to types defined directly in this
Schemathis map also includes implicitly-defined, built-in types likeGraphQLType::Bool,GraphQLType::Float,GraphQLType::ID, etc.
Sourcepub fn builder() -> SchemaBuilder
pub fn builder() -> SchemaBuilder
Helper function that just delegates to SchemaBuilder::new().
Sourcepub fn defined_directives(&self) -> ReadOnlyMap<'_, String, Directive>
pub fn defined_directives(&self) -> ReadOnlyMap<'_, String, Directive>
Returns a map from DirectiveName (String) -> Directive for all
non-builtin directives defined by this Schema.
⚠️ NOTE: This map does not include any of the built-in directives like
Directive::Deprecated,Directive::Include,Directive::Skip, etc. It only includes directives that were defined directly in thisSchema.
Sourcepub fn defined_types(&self) -> ReadOnlyMap<'_, String, GraphQLType>
pub fn defined_types(&self) -> ReadOnlyMap<'_, String, GraphQLType>
Returns a map from TypeName (String) -> GraphQLType for all
non-builtin types defined by this Schema.
⚠️ NOTE: This map does not include any of the built-in types like
GraphQLType::Bool,GraphQLType::Float,GraphQLType::ID, etc. It only includes types that were defined directly in thisSchema.
Sourcepub fn mutation_type(&self) -> Option<&GraphQLType>
pub fn mutation_type(&self) -> Option<&GraphQLType>
Returns this Schema’s Mutation root operation type (if one was
defined).
⚠️ NOTE: It is strongly recommended that you use
Schema::mutation_type()in favor of looking for anObjectTypewhose name is"Mutation". GraphQL defines an object type named “Mutation” as the default Mutation type , but it is aslo possible to override this default and use a differently-namedObjectTypeinstead.Schema::mutation_type()factors in any such override and will return the correctObjectTypefor this schema.
Sourcepub fn query_type(&self) -> &GraphQLType
pub fn query_type(&self) -> &GraphQLType
Returns this Schema’s Query root operation type.
⚠️ NOTE: It is strongly recommended that you use
Schema::query_type()in favor of looking for anObjectTypewhose name is"Query". GraphQL defines an object type named “Query” as the default Query type, but it is aslo possible to override this default and use a differently-namedObjectTypeinstead.Schema::query_type()factors in any such override and will return the correctObjectTypefor this schema.
Sourcepub fn subscription_type(&self) -> Option<&GraphQLType>
pub fn subscription_type(&self) -> Option<&GraphQLType>
Returns this Schema’s Subscription root operation type.
⚠️ NOTE: It is strongly recommended that you use
Schema::subscription_type()in favor of looking for anObjectTypewhose name is"Subscription". GraphQL defines an object type named “Subscription” as the default Subscription type, but it is aslo possible to override this default and use a differently-namedObjectTypeinstead.Schema::subscription_type()factors in any such override and will return the correctObjectTypefor this schema.