aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax/src')
-rw-r--r--crates/ra_syntax/src/ptr.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/crates/ra_syntax/src/ptr.rs b/crates/ra_syntax/src/ptr.rs
index 31167cada..e049fce61 100644
--- a/crates/ra_syntax/src/ptr.rs
+++ b/crates/ra_syntax/src/ptr.rs
@@ -43,7 +43,7 @@ impl SyntaxNodePtr {
43} 43}
44 44
45/// Like `SyntaxNodePtr`, but remembers the type of node 45/// Like `SyntaxNodePtr`, but remembers the type of node
46#[derive(Debug, PartialEq, Eq, Hash)] 46#[derive(Debug, Hash)]
47pub struct AstPtr<N: AstNode> { 47pub struct AstPtr<N: AstNode> {
48 raw: SyntaxNodePtr, 48 raw: SyntaxNodePtr,
49 _ty: PhantomData<fn() -> N>, 49 _ty: PhantomData<fn() -> N>,
@@ -56,6 +56,14 @@ impl<N: AstNode> Clone for AstPtr<N> {
56 } 56 }
57} 57}
58 58
59impl<N: AstNode> Eq for AstPtr<N> {}
60
61impl<N: AstNode> PartialEq for AstPtr<N> {
62 fn eq(&self, other: &AstPtr<N>) -> bool {
63 self.raw == other.raw
64 }
65}
66
59impl<N: AstNode> AstPtr<N> { 67impl<N: AstNode> AstPtr<N> {
60 pub fn new(node: &N) -> AstPtr<N> { 68 pub fn new(node: &N) -> AstPtr<N> {
61 AstPtr { raw: SyntaxNodePtr::new(node.syntax()), _ty: PhantomData } 69 AstPtr { raw: SyntaxNodePtr::new(node.syntax()), _ty: PhantomData }