Struct cynic::queries::SelectionBuilder

source ·
pub struct SelectionBuilder<'a, SchemaType, VariablesFields> { /* private fields */ }
Expand description

Builds a SelectionSet for the given SchemaType and VariablesFields

Implementations§

source§

impl<'a, SchemaType, VariablesFields> SelectionBuilder<'a, SchemaType, VariablesFields>

source

pub fn select_flattened_field<FieldMarker, Flattened, FieldType>( &mut self ) -> FieldSelectionBuilder<'_, FieldMarker, Flattened, VariablesFields>
where FieldMarker: Field, FieldType: FlattensInto<Flattened> + IsFieldType<SchemaType::Type>, SchemaType: HasField<FieldMarker>,

Selects a field applying the flattening rules to its type.

Note that the deserialization for this query must also implement these rules if calling this function.

source

pub fn select_field<FieldMarker, FieldType>( &mut self ) -> FieldSelectionBuilder<'_, FieldMarker, FieldType, VariablesFields>
where FieldMarker: Field, SchemaType: HasField<FieldMarker>, FieldType: IsFieldType<SchemaType::Type>,

Adds the FieldMarker field into this selection, with the given FieldType. Will type error if the field is not applicable or is not of this type.

This returns a FieldSelectionBuilder that can be used to apply arguments, aliases, and to build an inner selection.

source

pub fn recurse<FieldMarker, FieldType>( &mut self, max_depth: u8 ) -> Option<FieldSelectionBuilder<'_, FieldMarker, FieldType, VariablesFields>>
where FieldMarker: Field, SchemaType: HasField<FieldMarker>, FieldType: Recursable<FieldMarker::Type>,

Recursively selects a field into this selection, with the given FieldMarker and FieldType, up to the given max_depth.

This will return a None if we have reached the max_depth.

source

pub fn inline_fragment( &mut self ) -> InlineFragmentBuilder<'_, SchemaType, VariablesFields>

Adds an inline fragment to the SelectionSet

source

pub fn is_feature_enabled(&self, feature: &str) -> bool

Checks if a feature has been enabled for this operation.

QueryFragment implementations can use this to avoid sending parts of queries to servers that aren’t going to understand them.

Auto Trait Implementations§

§

impl<'a, SchemaType, VariablesFields> Freeze for SelectionBuilder<'a, SchemaType, VariablesFields>

§

impl<'a, SchemaType, VariablesFields> RefUnwindSafe for SelectionBuilder<'a, SchemaType, VariablesFields>

§

impl<'a, SchemaType, VariablesFields> Send for SelectionBuilder<'a, SchemaType, VariablesFields>

§

impl<'a, SchemaType, VariablesFields> Sync for SelectionBuilder<'a, SchemaType, VariablesFields>

§

impl<'a, SchemaType, VariablesFields> Unpin for SelectionBuilder<'a, SchemaType, VariablesFields>

§

impl<'a, SchemaType, VariablesFields> !UnwindSafe for SelectionBuilder<'a, SchemaType, VariablesFields>

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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

§

type Output = T

Should always be Self
source§

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

§

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

§

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.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> IsFieldType<T> for T