pub struct SchemaReference<'a> { /* private fields */ }
Expand description
Schema Reference
A stateful traverser that may be used to traverse a schema as a query is traversed. It supports diving into types by specifying fields and fragment conditions. As a query is traversed it keeps a stack of previous types, hence, as fields and fragments are traversed it can keep track of the current type that a selection set is operating on.
Implementations§
Source§impl<'a> SchemaReference<'a>
impl<'a> SchemaReference<'a>
Sourcepub fn from_object_type(
schema: &'a Schema<'_>,
object: &'a SchemaObject<'a>,
) -> Self
pub fn from_object_type( schema: &'a Schema<'_>, object: &'a SchemaObject<'a>, ) -> Self
Create a schema reference pointer from a given SchemaObject type to start from.
Sourcepub fn from_fragment(
schema: &'a Schema<'a>,
type_condition: &'a str,
) -> Result<Self>
pub fn from_fragment( schema: &'a Schema<'a>, type_condition: &'a str, ) -> Result<Self>
Create a schema reference pointer from a schema and selected fragment type-condition
Sourcepub fn from_schema(
schema: &'a Schema<'a>,
operation_kind: OperationKind,
) -> Result<Self>
pub fn from_schema( schema: &'a Schema<'a>, operation_kind: OperationKind, ) -> Result<Self>
Create a schema reference pointer from a schema and selected root operation kind.
Sourcepub fn leave_type(&mut self) -> Result<OutputType<'a>>
pub fn leave_type(&mut self) -> Result<OutputType<'a>>
Leave the current type and return to the previously pointed at output type.
Sourcepub fn output_type(&self) -> OutputType<'a>
pub fn output_type(&self) -> OutputType<'a>
Returns the current pointer’s referenced OutputType.
Sourcepub fn get_field(&self, field_name: &'a str) -> Option<&SchemaField<'a>>
pub fn get_field(&self, field_name: &'a str) -> Option<&SchemaField<'a>>
Returns a field, if possible, on the current OutputType.
Sourcepub fn select_field(&mut self, field_name: &'a str) -> Result<OutputType<'a>>
pub fn select_field(&mut self, field_name: &'a str) -> Result<OutputType<'a>>
Traverse deeper by selecting a field on the current OutputType and return the next OutputType.
Sourcepub fn select_condition(&mut self, type_name: &'a str) -> Result<OutputType<'a>>
pub fn select_condition(&mut self, type_name: &'a str) -> Result<OutputType<'a>>
Traverse deeper by applying a fragment condition on the current OutputType and return the next OutputType.
Trait Implementations§
Source§impl<'a> Clone for SchemaReference<'a>
impl<'a> Clone for SchemaReference<'a>
Source§fn clone(&self) -> SchemaReference<'a>
fn clone(&self) -> SchemaReference<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more