diff options
author | Aleksey Kladov <[email protected]> | 2021-05-22 14:53:47 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2021-05-22 14:53:47 +0100 |
commit | 188b0f96f98feaa0771f941343887c46113c8ced (patch) | |
tree | 870d3afb3479ea9f0c323d7c539ce615ec4a4651 /crates/syntax/src/ptr.rs | |
parent | e6776c3e1b66c8946873d20e1e3bc1d743c952fe (diff) |
Add more docs
Diffstat (limited to 'crates/syntax/src/ptr.rs')
-rw-r--r-- | crates/syntax/src/ptr.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/crates/syntax/src/ptr.rs b/crates/syntax/src/ptr.rs index d3fb7a5d9..195d2251b 100644 --- a/crates/syntax/src/ptr.rs +++ b/crates/syntax/src/ptr.rs | |||
@@ -1,4 +1,13 @@ | |||
1 | //! FIXME: write short doc here | 1 | //! In rust-analyzer, syntax trees are transient objects. |
2 | //! | ||
3 | //! That means that we create trees when we need them, and tear them down to | ||
4 | //! save memory. In this architecture, hanging on to a particular syntax node | ||
5 | //! for a long time is ill-advisable, as that keeps the whole tree resident. | ||
6 | //! | ||
7 | //! Instead, we provide a [`SyntaxNodePtr`] type, which stores information about | ||
8 | //! *location* of a particular syntax node in a tree. Its a small type which can | ||
9 | //! be cheaply stored, and which can be resolved to a real [`SyntaxNode`] when | ||
10 | //! necessary. | ||
2 | 11 | ||
3 | use std::{ | 12 | use std::{ |
4 | hash::{Hash, Hasher}, | 13 | hash::{Hash, Hasher}, |