Struct apollo_compiler::database::hir::FragmentSpread
source · pub struct FragmentSpread { /* private fields */ }
Implementations§
source§impl FragmentSpread
impl FragmentSpread
sourcepub fn fragment(&self, db: &dyn HirDatabase) -> Option<Arc<FragmentDefinition>>
pub fn fragment(&self, db: &dyn HirDatabase) -> Option<Arc<FragmentDefinition>>
Get the fragment definition this fragment spread is referencing.
sourcepub fn parent_type(&self, db: &dyn HirDatabase) -> Option<TypeDefinition>
pub fn parent_type(&self, db: &dyn HirDatabase) -> Option<TypeDefinition>
Get the type this fragment is spread onto.
Examples
type Query {
field: X
}
query {
...fragment
field { ...subFragment }
}
fragment.parent_type()
is Query
.
subFragment.parent_type()
is X
.
sourcepub fn self_used_variables(&self) -> impl Iterator<Item = Variable> + '_
pub fn self_used_variables(&self) -> impl Iterator<Item = Variable> + '_
Return an iterator over the variables used in directives on this spread.
Variables used by the fragment definition are not included. For that, use
variables()
.
sourcepub fn variables(&self, db: &dyn HirDatabase) -> Vec<Variable>
pub fn variables(&self, db: &dyn HirDatabase) -> Vec<Variable>
Get fragment spread’s defined variables.
sourcepub fn directives(&self) -> &[Directive]
pub fn directives(&self) -> &[Directive]
Get a reference to fragment spread directives.
sourcepub fn directive_by_name(&self, name: &str) -> Option<&Directive>
pub fn directive_by_name(&self, name: &str) -> Option<&Directive>
Returns the first directive with the given name.
For repeatable directives, see directives_by_name
(plural).
sourcepub fn directives_by_name<'def: 'name, 'name>(
&'def self,
name: &'name str
) -> impl Iterator<Item = &'def Directive> + 'name
pub fn directives_by_name<'def: 'name, 'name>( &'def self, name: &'name str ) -> impl Iterator<Item = &'def Directive> + 'name
Returns an iterator of directives with the given name.
For non-repeatable directives, directive_by_name
(singular).
sourcepub fn loc(&self) -> HirNodeLocation
pub fn loc(&self) -> HirNodeLocation
Get the AST location information for this HIR node.
sourcepub fn is_introspection(&self, db: &dyn HirDatabase) -> bool
pub fn is_introspection(&self, db: &dyn HirDatabase) -> bool
Returns true if the fragment referenced by this spread exists and its
SelectionSet
is an introspection.
Trait Implementations§
source§impl Clone for FragmentSpread
impl Clone for FragmentSpread
source§fn clone(&self) -> FragmentSpread
fn clone(&self) -> FragmentSpread
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for FragmentSpread
impl Debug for FragmentSpread
source§impl Hash for FragmentSpread
impl Hash for FragmentSpread
source§impl PartialEq<FragmentSpread> for FragmentSpread
impl PartialEq<FragmentSpread> for FragmentSpread
source§fn eq(&self, other: &FragmentSpread) -> bool
fn eq(&self, other: &FragmentSpread) -> bool
self
and other
values to be equal, and is used
by ==
.impl Eq for FragmentSpread
impl StructuralEq for FragmentSpread
impl StructuralPartialEq for FragmentSpread
Auto Trait Implementations§
impl RefUnwindSafe for FragmentSpread
impl Send for FragmentSpread
impl Sync for FragmentSpread
impl Unpin for FragmentSpread
impl UnwindSafe for FragmentSpread
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
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
key
and return true
if they are equal.