Struct apollo_compiler::database::hir::Field
source · pub struct Field { /* private fields */ }
Implementations§
source§impl Field
impl Field
sourcepub fn name(&self) -> &str
pub fn name(&self) -> &str
Get the field’s name, corresponding to the definition it looks up.
For example, in this operation, the .name()
is “sourceField”:
query GetField { alias: sourceField }
sourcepub fn response_name(&self) -> &str
pub fn response_name(&self) -> &str
Get the name that will be used for this field selection in response formatting.
For example, in this operation, the .response_name()
is “sourceField”:
query GetField { sourceField }
But in this operation that uses an alias, the .response_name()
is “responseField”:
query GetField { responseField: sourceField }
sourcepub fn ty(&self, db: &dyn HirDatabase) -> Option<Type>
pub fn ty(&self, db: &dyn HirDatabase) -> Option<Type>
Get a reference to field’s type.
sourcepub fn parent_type(&self, db: &dyn HirDatabase) -> Option<TypeDefinition>
pub fn parent_type(&self, db: &dyn HirDatabase) -> Option<TypeDefinition>
Get the field’s parent type definition.
sourcepub fn field_definition(&self, db: &dyn HirDatabase) -> Option<FieldDefinition>
pub fn field_definition(&self, db: &dyn HirDatabase) -> Option<FieldDefinition>
Get field’s original field definition.
sourcepub fn directives(&self) -> &[Directive]
pub fn directives(&self) -> &[Directive]
Get a reference to the field’s 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 selection_set(&self) -> &SelectionSet
pub fn selection_set(&self) -> &SelectionSet
Get a reference to the field’s selection set.
sourcepub fn variables(&self, db: &dyn HirDatabase) -> Vec<Variable>
pub fn variables(&self, db: &dyn HirDatabase) -> Vec<Variable>
Get variables used in the field, including in sub-selections.
For example, with this field:
{
field(arg: $arg) {
number(formatAs: $format)
}
}
the used variables are $arg
and $format
.
sourcepub fn loc(&self) -> HirNodeLocation
pub fn loc(&self) -> HirNodeLocation
Get the AST location information for this HIR node.
sourcepub fn is_introspection(&self) -> bool
pub fn is_introspection(&self) -> bool
Returns true if this is an introspection field (i.e. it’s
Self::name()
is one of __type, or __schema).
Trait Implementations§
source§impl PartialEq<Field> for Field
impl PartialEq<Field> for Field
impl Eq for Field
impl StructuralEq for Field
impl StructuralPartialEq for Field
Auto Trait Implementations§
impl RefUnwindSafe for Field
impl Send for Field
impl Sync for Field
impl Unpin for Field
impl UnwindSafe for Field
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.