Struct SchemaReference

Source
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>

Source

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.

Source

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

Source

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.

Source

pub fn leave_type(&mut self) -> Result<OutputType<'a>>

Leave the current type and return to the previously pointed at output type.

Source

pub fn output_type(&self) -> OutputType<'a>

Returns the current pointer’s referenced OutputType.

Source

pub fn get_field(&self, field_name: &'a str) -> Option<&SchemaField<'a>>

Returns a field, if possible, on the current OutputType.

Source

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.

Source

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>

Source§

fn clone(&self) -> SchemaReference<'a>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for SchemaReference<'a>

§

impl<'a> !RefUnwindSafe for SchemaReference<'a>

§

impl<'a> !Send for SchemaReference<'a>

§

impl<'a> !Sync for SchemaReference<'a>

§

impl<'a> Unpin for SchemaReference<'a>

§

impl<'a> !UnwindSafe for SchemaReference<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.