Enum apollo_compiler::database::hir::FragmentSelection
source · pub enum FragmentSelection {
FragmentSpread(Arc<FragmentSpread>),
InlineFragment(Arc<InlineFragment>),
}
Expand description
Represent both kinds of fragment selections: named and inline fragments.
Variants§
FragmentSpread(Arc<FragmentSpread>)
InlineFragment(Arc<InlineFragment>)
Implementations§
source§impl FragmentSelection
impl FragmentSelection
sourcepub fn type_condition(&self, db: &dyn HirDatabase) -> Option<String>
pub fn type_condition(&self, db: &dyn HirDatabase) -> Option<String>
Get the name of this fragment’s type condition.
This returns None
on the following invalid inputs:
self
is a named fragment spread, but the fragment it refers to is not definedself
is an inline fragment without an explicit type condition, used in a selection set with a declared parent type that is not defined in the schema
sourcepub fn selection_set(&self, db: &dyn HirDatabase) -> Option<SelectionSet>
pub fn selection_set(&self, db: &dyn HirDatabase) -> Option<SelectionSet>
Get this fragment’s selection set. This may be None
if the fragment spread refers to an
undefined fragment.
sourcepub fn parent_type(&self, db: &dyn HirDatabase) -> Option<TypeDefinition>
pub fn parent_type(&self, db: &dyn HirDatabase) -> Option<TypeDefinition>
Get the type that this fragment is being spread onto.
Returns None
if the fragment is spread into a selection of an undefined field or type,
like in:
type Query {
field: Int
}
query {
nonExistentField {
... spreadToUnknownType
}
}
sourcepub fn loc(&self) -> HirNodeLocation
pub fn loc(&self) -> HirNodeLocation
Get the AST location information for this HIR node.
Trait Implementations§
source§impl Clone for FragmentSelection
impl Clone for FragmentSelection
source§fn clone(&self) -> FragmentSelection
fn clone(&self) -> FragmentSelection
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for FragmentSelection
impl Debug for FragmentSelection
source§impl Hash for FragmentSelection
impl Hash for FragmentSelection
source§impl PartialEq<FragmentSelection> for FragmentSelection
impl PartialEq<FragmentSelection> for FragmentSelection
source§fn eq(&self, other: &FragmentSelection) -> bool
fn eq(&self, other: &FragmentSelection) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Eq for FragmentSelection
impl StructuralEq for FragmentSelection
impl StructuralPartialEq for FragmentSelection
Auto Trait Implementations§
impl RefUnwindSafe for FragmentSelection
impl Send for FragmentSelection
impl Sync for FragmentSelection
impl Unpin for FragmentSelection
impl UnwindSafe for FragmentSelection
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
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.