pub enum Definition<'src> {
DirectiveDefinition(DirectiveDefinition<'src>),
FragmentDefinition(FragmentDefinition<'src>),
OperationDefinition(OperationDefinition<'src>),
SchemaDefinition(SchemaDefinition<'src>),
SchemaExtension(SchemaExtension<'src>),
TypeDefinition(TypeDefinition<'src>),
TypeExtension(TypeExtension<'src>),
}Expand description
A top-level definition in a GraphQL document.
Covers both type-system definitions (schema, types, directives, extensions) and executable definitions (operations, fragments).
See Document in the spec.
Variants§
DirectiveDefinition(DirectiveDefinition<'src>)
FragmentDefinition(FragmentDefinition<'src>)
OperationDefinition(OperationDefinition<'src>)
SchemaDefinition(SchemaDefinition<'src>)
SchemaExtension(SchemaExtension<'src>)
TypeDefinition(TypeDefinition<'src>)
TypeExtension(TypeExtension<'src>)
Implementations§
Source§impl<'src> Definition<'src>
impl<'src> Definition<'src>
Sourcepub fn description(&self) -> Option<&StringValue<'src>>
pub fn description(&self) -> Option<&StringValue<'src>>
Returns the description string for this definition, if one is present.
Sourcepub fn directive_annotations(&self) -> &[DirectiveAnnotation<'src>]
pub fn directive_annotations(&self) -> &[DirectiveAnnotation<'src>]
Returns the directive annotations applied to this definition.
Sourcepub fn name_value(&self) -> Option<&str>
pub fn name_value(&self) -> Option<&str>
Returns the name of this definition as a string slice,
or None for unnamed definitions (schema
definitions/extensions, anonymous operations).
Convenience accessor for self.name().value.
Source§impl Definition<'_>
impl Definition<'_>
Sourcepub fn append_source(&self, sink: &mut String, source: Option<&str>)
pub fn append_source(&self, sink: &mut String, source: Option<&str>)
Sourcepub fn byte_span(&self) -> ByteSpan
pub fn byte_span(&self) -> ByteSpan
Returns this definition’s byte-offset span within the source text.
The returned ByteSpan can be resolved to line/column
positions via source_span() or
ByteSpan::resolve().
Sourcepub fn source_span(&self, source_map: &SourceMap<'_>) -> Option<SourceSpan>
pub fn source_span(&self, source_map: &SourceMap<'_>) -> Option<SourceSpan>
Trait Implementations§
Source§impl AstNode for Definition<'_>
impl AstNode for Definition<'_>
Source§fn byte_span(&self) -> ByteSpan
fn byte_span(&self) -> ByteSpan
Returns this definition’s byte-offset span within the source text.
The returned ByteSpan can be resolved to line/column
positions via source_span() or
ByteSpan::resolve().
Source§fn source_span(&self, source_map: &SourceMap<'_>) -> Option<SourceSpan>
fn source_span(&self, source_map: &SourceMap<'_>) -> Option<SourceSpan>
Source§impl<'src> Clone for Definition<'src>
impl<'src> Clone for Definition<'src>
Source§fn clone(&self) -> Definition<'src>
fn clone(&self) -> Definition<'src>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more