Struct glsl_lang::ast::Node

source ·
pub struct Node<T>
where T: NodeContent,
{ pub content: T, pub span: Option<NodeSpan>, }
Expand description

A syntax node with span information

Fields§

§content: T

Contents of this syntax node

§span: Option<NodeSpan>

Span in the input this node was parsed from

Implementations§

source§

impl<T> Node<T>
where T: NodeContent,

source

pub fn new(content: T, span: Option<NodeSpan>) -> Node<T>

Create a new syntax node with span information

source

pub fn into_inner(self) -> T

Return the wrapped syntax node, discarding the span information

source

pub fn map<U>(self, f: impl FnOnce(T) -> U) -> Node<U>
where U: NodeContent,

Map this content of this node into a new node

source

pub fn map_spanned<U>(self, f: impl FnOnce(Node<T>) -> U) -> Node<U>
where U: NodeContent,

Map this content of this node into a new node with the same span

Trait Implementations§

source§

impl<U, T> AsRef<U> for Node<T>
where T: NodeContent + AsRef<U>,

source§

fn as_ref(&self) -> &U

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<T> Clone for Node<T>
where T: Clone + NodeContent,

source§

fn clone(&self) -> Node<T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T> Debug for Node<T>
where T: Debug + NodeContent,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl<T> Deref for Node<T>
where T: NodeContent,

§

type Target = T

The resulting type after dereferencing.
source§

fn deref(&self) -> &<Node<T> as Deref>::Target

Dereferences the value.
source§

impl<T> DerefMut for Node<T>
where T: NodeContent,

source§

fn deref_mut(&mut self) -> &mut <Node<T> as Deref>::Target

Mutably dereferences the value.
source§

impl<T> Display for Node<T>
where T: NodeContent + Display,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl From<Node<ArraySpecifierData>> for ArraySpecifierData

source§

fn from(node: Node<ArraySpecifierData>) -> ArraySpecifierData

Converts to this type from the input type.
source§

impl From<Node<ArraySpecifierDimensionData>> for ArraySpecifierDimensionData

source§

fn from(node: Node<ArraySpecifierDimensionData>) -> ArraySpecifierDimensionData

Converts to this type from the input type.
source§

impl From<Node<ArrayedIdentifierData>> for ArrayedIdentifierData

source§

fn from(node: Node<ArrayedIdentifierData>) -> ArrayedIdentifierData

Converts to this type from the input type.
source§

impl From<Node<AssignmentOpData>> for AssignmentOpData

source§

fn from(node: Node<AssignmentOpData>) -> AssignmentOpData

Converts to this type from the input type.
source§

impl From<Node<BinaryOpData>> for BinaryOpData

source§

fn from(node: Node<BinaryOpData>) -> BinaryOpData

Converts to this type from the input type.
source§

impl From<Node<BlockData>> for BlockData

source§

fn from(node: Node<BlockData>) -> BlockData

Converts to this type from the input type.
source§

impl From<Node<CaseLabelData>> for CaseLabelData

source§

fn from(node: Node<CaseLabelData>) -> CaseLabelData

Converts to this type from the input type.
source§

impl From<Node<CommentData>> for CommentData

source§

fn from(node: Node<CommentData>) -> CommentData

Converts to this type from the input type.
source§

impl From<Node<CompoundStatementData>> for CompoundStatementData

source§

fn from(node: Node<CompoundStatementData>) -> CompoundStatementData

Converts to this type from the input type.
source§

impl From<Node<ConditionData>> for ConditionData

source§

fn from(node: Node<ConditionData>) -> ConditionData

Converts to this type from the input type.
source§

impl From<Node<DeclarationData>> for DeclarationData

source§

fn from(node: Node<DeclarationData>) -> DeclarationData

Converts to this type from the input type.
source§

impl From<Node<ExprData>> for ExprData

source§

fn from(node: Node<ExprData>) -> ExprData

Converts to this type from the input type.
source§

impl From<Node<ExprData>> for InitializerData

source§

fn from(e: Node<ExprData>) -> InitializerData

Converts to this type from the input type.
source§

impl From<Node<ExprStatementData>> for ExprStatementData

source§

fn from(node: Node<ExprStatementData>) -> ExprStatementData

Converts to this type from the input type.
source§

impl From<Node<ExternalDeclarationData>> for ExternalDeclarationData

source§

fn from(node: Node<ExternalDeclarationData>) -> ExternalDeclarationData

Converts to this type from the input type.
source§

impl From<Node<ForInitStatementData>> for ForInitStatementData

source§

fn from(node: Node<ForInitStatementData>) -> ForInitStatementData

Converts to this type from the input type.
source§

impl From<Node<ForRestStatementData>> for ForRestStatementData

source§

fn from(node: Node<ForRestStatementData>) -> ForRestStatementData

Converts to this type from the input type.
source§

impl From<Node<FullySpecifiedTypeData>> for FullySpecifiedTypeData

source§

fn from(node: Node<FullySpecifiedTypeData>) -> FullySpecifiedTypeData

Converts to this type from the input type.
source§

impl From<Node<FunIdentifierData>> for FunIdentifierData

source§

fn from(node: Node<FunIdentifierData>) -> FunIdentifierData

Converts to this type from the input type.
source§

impl From<Node<FunctionDefinitionData>> for FunctionDefinitionData

source§

fn from(node: Node<FunctionDefinitionData>) -> FunctionDefinitionData

Converts to this type from the input type.
source§

impl From<Node<FunctionParameterDeclarationData>> for FunctionParameterDeclarationData

source§

fn from( node: Node<FunctionParameterDeclarationData> ) -> FunctionParameterDeclarationData

Converts to this type from the input type.
source§

impl From<Node<FunctionParameterDeclaratorData>> for FunctionParameterDeclaratorData

source§

fn from( node: Node<FunctionParameterDeclaratorData> ) -> FunctionParameterDeclaratorData

Converts to this type from the input type.
source§

impl From<Node<FunctionPrototypeData>> for FunctionPrototypeData

source§

fn from(node: Node<FunctionPrototypeData>) -> FunctionPrototypeData

Converts to this type from the input type.
source§

impl From<Node<IdentifierData>> for IdentifierData

source§

fn from(node: Node<IdentifierData>) -> IdentifierData

Converts to this type from the input type.
source§

impl From<Node<InitDeclaratorListData>> for InitDeclaratorListData

source§

fn from(node: Node<InitDeclaratorListData>) -> InitDeclaratorListData

Converts to this type from the input type.
source§

impl From<Node<InitializerData>> for InitializerData

source§

fn from(node: Node<InitializerData>) -> InitializerData

Converts to this type from the input type.
source§

impl From<Node<InterpolationQualifierData>> for InterpolationQualifierData

source§

fn from(node: Node<InterpolationQualifierData>) -> InterpolationQualifierData

Converts to this type from the input type.
source§

impl From<Node<IterationStatementData>> for IterationStatementData

source§

fn from(node: Node<IterationStatementData>) -> IterationStatementData

Converts to this type from the input type.
source§

impl From<Node<JumpStatementData>> for JumpStatementData

source§

fn from(node: Node<JumpStatementData>) -> JumpStatementData

Converts to this type from the input type.
source§

impl From<Node<LayoutQualifierData>> for LayoutQualifierData

source§

fn from(node: Node<LayoutQualifierData>) -> LayoutQualifierData

Converts to this type from the input type.
source§

impl From<Node<LayoutQualifierSpecData>> for LayoutQualifierSpecData

source§

fn from(node: Node<LayoutQualifierSpecData>) -> LayoutQualifierSpecData

Converts to this type from the input type.
source§

impl From<Node<PathData>> for PathData

source§

fn from(node: Node<PathData>) -> PathData

Converts to this type from the input type.
source§

impl From<Node<PrecisionQualifierData>> for PrecisionQualifierData

source§

fn from(node: Node<PrecisionQualifierData>) -> PrecisionQualifierData

Converts to this type from the input type.
source§

impl From<Node<PreprocessorData>> for PreprocessorData

source§

fn from(node: Node<PreprocessorData>) -> PreprocessorData

Converts to this type from the input type.
source§

impl From<Node<PreprocessorDefineData>> for PreprocessorDefineData

source§

fn from(node: Node<PreprocessorDefineData>) -> PreprocessorDefineData

Converts to this type from the input type.
source§

impl From<Node<PreprocessorElseIfData>> for PreprocessorElseIfData

source§

fn from(node: Node<PreprocessorElseIfData>) -> PreprocessorElseIfData

Converts to this type from the input type.
source§

impl From<Node<PreprocessorErrorData>> for PreprocessorErrorData

source§

fn from(node: Node<PreprocessorErrorData>) -> PreprocessorErrorData

Converts to this type from the input type.
source§

impl From<Node<PreprocessorExtensionBehaviorData>> for PreprocessorExtensionBehaviorData

source§

fn from( node: Node<PreprocessorExtensionBehaviorData> ) -> PreprocessorExtensionBehaviorData

Converts to this type from the input type.
source§

impl From<Node<PreprocessorExtensionData>> for PreprocessorExtensionData

source§

fn from(node: Node<PreprocessorExtensionData>) -> PreprocessorExtensionData

Converts to this type from the input type.
source§

impl From<Node<PreprocessorExtensionNameData>> for PreprocessorExtensionNameData

source§

fn from( node: Node<PreprocessorExtensionNameData> ) -> PreprocessorExtensionNameData

Converts to this type from the input type.
source§

impl From<Node<PreprocessorIfData>> for PreprocessorIfData

source§

fn from(node: Node<PreprocessorIfData>) -> PreprocessorIfData

Converts to this type from the input type.
source§

impl From<Node<PreprocessorIfDefData>> for PreprocessorIfDefData

source§

fn from(node: Node<PreprocessorIfDefData>) -> PreprocessorIfDefData

Converts to this type from the input type.
source§

impl From<Node<PreprocessorIfNDefData>> for PreprocessorIfNDefData

source§

fn from(node: Node<PreprocessorIfNDefData>) -> PreprocessorIfNDefData

Converts to this type from the input type.
source§

impl From<Node<PreprocessorIncludeData>> for PreprocessorIncludeData

source§

fn from(node: Node<PreprocessorIncludeData>) -> PreprocessorIncludeData

Converts to this type from the input type.
source§

impl From<Node<PreprocessorLineData>> for PreprocessorLineData

source§

fn from(node: Node<PreprocessorLineData>) -> PreprocessorLineData

Converts to this type from the input type.
source§

impl From<Node<PreprocessorPragmaData>> for PreprocessorPragmaData

source§

fn from(node: Node<PreprocessorPragmaData>) -> PreprocessorPragmaData

Converts to this type from the input type.
source§

impl From<Node<PreprocessorUndefData>> for PreprocessorUndefData

source§

fn from(node: Node<PreprocessorUndefData>) -> PreprocessorUndefData

Converts to this type from the input type.
source§

impl From<Node<PreprocessorVersionData>> for PreprocessorVersionData

source§

fn from(node: Node<PreprocessorVersionData>) -> PreprocessorVersionData

Converts to this type from the input type.
source§

impl From<Node<PreprocessorVersionProfileData>> for PreprocessorVersionProfileData

source§

fn from( node: Node<PreprocessorVersionProfileData> ) -> PreprocessorVersionProfileData

Converts to this type from the input type.
source§

impl From<Node<SelectionRestStatementData>> for SelectionRestStatementData

source§

fn from(node: Node<SelectionRestStatementData>) -> SelectionRestStatementData

Converts to this type from the input type.
source§

impl From<Node<SelectionStatementData>> for SelectionStatementData

source§

fn from(node: Node<SelectionStatementData>) -> SelectionStatementData

Converts to this type from the input type.
source§

impl From<Node<SingleDeclarationData>> for SingleDeclarationData

source§

fn from(node: Node<SingleDeclarationData>) -> SingleDeclarationData

Converts to this type from the input type.
source§

impl From<Node<SingleDeclarationNoTypeData>> for SingleDeclarationNoTypeData

source§

fn from(node: Node<SingleDeclarationNoTypeData>) -> SingleDeclarationNoTypeData

Converts to this type from the input type.
source§

impl From<Node<StatementData>> for StatementData

source§

fn from(node: Node<StatementData>) -> StatementData

Converts to this type from the input type.
source§

impl From<Node<StorageQualifierData>> for StorageQualifierData

source§

fn from(node: Node<StorageQualifierData>) -> StorageQualifierData

Converts to this type from the input type.
source§

impl From<Node<StructFieldSpecifierData>> for StructFieldSpecifierData

source§

fn from(node: Node<StructFieldSpecifierData>) -> StructFieldSpecifierData

Converts to this type from the input type.
source§

impl From<Node<StructSpecifierData>> for StructSpecifierData

source§

fn from(node: Node<StructSpecifierData>) -> StructSpecifierData

Converts to this type from the input type.
source§

impl From<Node<SwitchStatementData>> for SwitchStatementData

source§

fn from(node: Node<SwitchStatementData>) -> SwitchStatementData

Converts to this type from the input type.
source§

impl From<Node<TypeNameData>> for TypeNameData

source§

fn from(node: Node<TypeNameData>) -> TypeNameData

Converts to this type from the input type.
source§

impl From<Node<TypeNameData>> for TypeSpecifierNonArrayData

source§

fn from(tn: Node<TypeNameData>) -> TypeSpecifierNonArrayData

Converts to this type from the input type.
source§

impl From<Node<TypeQualifierData>> for TypeQualifierData

source§

fn from(node: Node<TypeQualifierData>) -> TypeQualifierData

Converts to this type from the input type.
source§

impl From<Node<TypeQualifierSpecData>> for TypeQualifierSpecData

source§

fn from(node: Node<TypeQualifierSpecData>) -> TypeQualifierSpecData

Converts to this type from the input type.
source§

impl From<Node<TypeSpecifierData>> for TypeSpecifierData

source§

fn from(node: Node<TypeSpecifierData>) -> TypeSpecifierData

Converts to this type from the input type.
source§

impl From<Node<TypeSpecifierNonArrayData>> for TypeSpecifierData

source§

fn from(ty: Node<TypeSpecifierNonArrayData>) -> TypeSpecifierData

Converts to this type from the input type.
source§

impl From<Node<TypeSpecifierNonArrayData>> for TypeSpecifierNonArrayData

source§

fn from(node: Node<TypeSpecifierNonArrayData>) -> TypeSpecifierNonArrayData

Converts to this type from the input type.
source§

impl From<Node<UnaryOpData>> for UnaryOpData

source§

fn from(node: Node<UnaryOpData>) -> UnaryOpData

Converts to this type from the input type.
source§

impl<T> From<T> for Node<T>
where T: NodeContent,

source§

fn from(inner: T) -> Node<T>

Converts to this type from the input type.
source§

impl FromIterator<Node<StatementData>> for CompoundStatementData

source§

fn from_iter<T>(iter: T) -> CompoundStatementData
where T: IntoIterator<Item = Node<StatementData>>,

Creates a value from an iterator. Read more
source§

impl<T> Hash for Node<T>
where T: NodeContent + Hash,

source§

fn hash<H>(&self, state: &mut H)
where H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<T> NodeDisplay for Node<T>

source§

fn name() -> Option<&'static str>

Name of the syntax node’s type
source§

fn start(&self) -> Option<TextSize>

Starting position of the node
source§

fn end(&self) -> Option<TextSize>

Ending position of the node
source§

fn source_id(&self) -> Option<FileId>

Source id of the node
source§

fn display(&self) -> NodeDisplayWrapper<'_, Node<T>>

Obtain a display wrapper for the current node
source§

fn display_extra(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Display extra information for the node Read more
source§

fn display_children( &self, level: usize, f: &mut Formatter<'_> ) -> Result<(), Error>

Display the node’s children Read more
source§

impl<T> Ord for Node<T>
where T: NodeContent + Ord,

source§

fn cmp(&self, other: &Node<T>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl<T> PartialEq for Node<T>

source§

fn eq(&self, other: &Node<T>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T> PartialOrd for Node<T>

source§

fn partial_cmp(&self, other: &Node<T>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<T> Copy for Node<T>
where T: NodeContent + Copy,

source§

impl<T> Eq for Node<T>
where T: NodeContent + Eq,

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for Node<T>
where T: RefUnwindSafe,

§

impl<T> Send for Node<T>
where T: Send,

§

impl<T> Sync for Node<T>
where T: Sync,

§

impl<T> Unpin for Node<T>
where T: Unpin,

§

impl<T> UnwindSafe for Node<T>
where T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<!> for T

source§

fn from(t: !) -> T

Converts to this type from the input type.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.