pub trait CstNode {
    // Required methods
    fn can_cast(kind: SyntaxKind) -> bool
       where Self: Sized;
    fn cast(syntax: SyntaxNode) -> Option<Self>
       where Self: Sized;
    fn syntax(&self) -> &SyntaxNode;

    // Provided methods
    fn source_string(&self) -> String { ... }
    fn clone_for_update(&self) -> Self
       where Self: Sized { ... }
    fn clone_subtree(&self) -> Self
       where Self: Sized { ... }
}
Expand description

The main trait to go from untyped SyntaxNode to a typed CST. The conversion itself has zero runtime cost: CST and syntax nodes have exactly the same representation: a pointer to the tree root and a pointer to the node itself.

Required Methods§

source

fn can_cast(kind: SyntaxKind) -> bool
where Self: Sized,

source

fn cast(syntax: SyntaxNode) -> Option<Self>
where Self: Sized,

source

fn syntax(&self) -> &SyntaxNode

Provided Methods§

source

fn source_string(&self) -> String

source

fn clone_for_update(&self) -> Self
where Self: Sized,

source

fn clone_subtree(&self) -> Self
where Self: Sized,

Implementors§

source§

impl CstNode for Definition

source§

impl CstNode for Selection

source§

impl CstNode for Type

source§

impl CstNode for Value

source§

impl CstNode for Alias

source§

impl CstNode for Argument

source§

impl CstNode for Arguments

source§

impl CstNode for ArgumentsDefinition

source§

impl CstNode for BooleanValue

source§

impl CstNode for DefaultValue

source§

impl CstNode for Description

source§

impl CstNode for Directive

source§

impl CstNode for DirectiveDefinition

source§

impl CstNode for DirectiveLocation

source§

impl CstNode for DirectiveLocations

source§

impl CstNode for Directives

source§

impl CstNode for Document

source§

impl CstNode for EnumTypeDefinition

source§

impl CstNode for EnumTypeExtension

source§

impl CstNode for EnumValue

source§

impl CstNode for EnumValueDefinition

source§

impl CstNode for EnumValuesDefinition

source§

impl CstNode for Field

source§

impl CstNode for FieldDefinition

source§

impl CstNode for FieldsDefinition

source§

impl CstNode for FloatValue

source§

impl CstNode for FragmentDefinition

source§

impl CstNode for FragmentName

source§

impl CstNode for FragmentSpread

source§

impl CstNode for ImplementsInterfaces

source§

impl CstNode for InlineFragment

source§

impl CstNode for InputFieldsDefinition

source§

impl CstNode for InputObjectTypeDefinition

source§

impl CstNode for InputObjectTypeExtension

source§

impl CstNode for InputValueDefinition

source§

impl CstNode for IntValue

source§

impl CstNode for InterfaceTypeDefinition

source§

impl CstNode for InterfaceTypeExtension

source§

impl CstNode for ListType

source§

impl CstNode for ListValue

source§

impl CstNode for Name

source§

impl CstNode for NamedType

source§

impl CstNode for NonNullType

source§

impl CstNode for NullValue

source§

impl CstNode for ObjectField

source§

impl CstNode for ObjectTypeDefinition

source§

impl CstNode for ObjectTypeExtension

source§

impl CstNode for ObjectValue

source§

impl CstNode for OperationDefinition

source§

impl CstNode for OperationType

source§

impl CstNode for RootOperationTypeDefinition

source§

impl CstNode for ScalarTypeDefinition

source§

impl CstNode for ScalarTypeExtension

source§

impl CstNode for SchemaDefinition

source§

impl CstNode for SchemaExtension

source§

impl CstNode for SelectionSet

source§

impl CstNode for StringValue

source§

impl CstNode for TypeCondition

source§

impl CstNode for UnionMemberTypes

source§

impl CstNode for UnionTypeDefinition

source§

impl CstNode for UnionTypeExtension

source§

impl CstNode for Variable

source§

impl CstNode for VariableDefinition

source§

impl CstNode for VariableDefinitions