Skip to main content

Module ptr

Module ptr 

Source
Expand description

In rust-analyzer, syntax trees are transient objects.

That means that we create trees when we need them, and tear them down to save memory. In this architecture, hanging on to a particular syntax node for a long time is ill-advisable, as that keeps the whole tree resident.

Instead, we provide a SyntaxNodePtr type, which stores information about location of a particular syntax node in a tree. Its a small type which can be cheaply stored, and which can be resolved to a real SyntaxNode when necessary.

Structs§

AstPtr
Like SyntaxNodePtr, but remembers the type of node.

Type Aliases§

SyntaxNodePtr
A “pointer” to a SyntaxNode, via location in the source code.