pub struct Schema<'a> { /* private fields */ }
Expand description
Schema Definition
A schema is created from root types for each kind of operation and is then used against AST documents for validation and execution. In this library the schema is never executable and serves only for metadata and type information. It is hence a “Client Schema”. Reference
Implementations§
Source§impl<'a> Schema<'a>
impl<'a> Schema<'a>
Sourcepub fn query_type(&self) -> Option<&'a SchemaObject<'a>>
pub fn query_type(&self) -> Option<&'a SchemaObject<'a>>
Returns the root object type for query operations
Sourcepub fn mutation_type(&self) -> Option<&'a SchemaObject<'a>>
pub fn mutation_type(&self) -> Option<&'a SchemaObject<'a>>
Returns the root object type for mutation operations
Sourcepub fn subscription_type(&self) -> Option<&'a SchemaObject<'a>>
pub fn subscription_type(&self) -> Option<&'a SchemaObject<'a>>
Returns the root object type for subscription operations
Sourcepub fn get_root_type(
&self,
operation_kind: OperationKind,
) -> Option<&'a SchemaObject<'a>>
pub fn get_root_type( &self, operation_kind: OperationKind, ) -> Option<&'a SchemaObject<'a>>
Returns the appropriate object type depending on the passed operation kind
Sourcepub fn get_type(&self, name: &'a str) -> Option<&'a SchemaType<'a>>
pub fn get_type(&self, name: &'a str) -> Option<&'a SchemaType<'a>>
Retrieves a kind by name from known schema types.
Sourcepub fn is_sub_type(
&self,
abstract_type: SchemaType<'a>,
sub_type: SchemaType<'a>,
) -> bool
pub fn is_sub_type( &self, abstract_type: SchemaType<'a>, sub_type: SchemaType<'a>, ) -> bool
Checks whether a given type is a sub type of another.
This is typically used for return types of fields. A return type may be any given sub type of the return type of said field.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Schema<'a>
impl<'a> !RefUnwindSafe for Schema<'a>
impl<'a> !Send for Schema<'a>
impl<'a> !Sync for Schema<'a>
impl<'a> Unpin for Schema<'a>
impl<'a> !UnwindSafe for Schema<'a>
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