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>
impl<'a, SchemaType, VariablesFields> SelectionBuilder<'a, SchemaType, VariablesFields>
sourcepub 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>,
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.
sourcepub fn select_field<FieldMarker, FieldType>(
&mut self
) -> FieldSelectionBuilder<'_, FieldMarker, FieldType, VariablesFields>where
FieldMarker: Field,
SchemaType: HasField<FieldMarker>,
FieldType: IsFieldType<SchemaType::Type>,
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.
sourcepub fn recurse<FieldMarker, FieldType>(
&mut self,
max_depth: u8
) -> Option<FieldSelectionBuilder<'_, FieldMarker, FieldType, VariablesFields>>where
FieldMarker: Field,
SchemaType: HasField<FieldMarker>,
FieldType: Recursable<FieldMarker::Type>,
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.
sourcepub fn inline_fragment(
&mut self
) -> InlineFragmentBuilder<'_, SchemaType, VariablesFields>
pub fn inline_fragment( &mut self ) -> InlineFragmentBuilder<'_, SchemaType, VariablesFields>
Adds an inline fragment to the SelectionSet
sourcepub fn is_feature_enabled(&self, feature: &str) -> bool
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.