Implement Eq and Hash for GreenTokenData#174
Implement Eq and Hash for GreenTokenData#174hurryabit wants to merge 1 commit intorust-analyzer:masterfrom
Conversation
`GreenToken` implements all traits required to use it as the key type of a hash map. It also implements `Borrow<GreenTokenData>`. Thus is would be nice if `GreenTokenData` also implements `Eq` and `Hash` such that the result of `SyntaxToken::green` can be used for lookups in such a hash map without additional overhead in terms of sytntax and runtime.
|
Consider if you might want to intern GreenTokens&Nodes, and use pointer-equality and identity instead of content hashing |
|
Thanks for your quick response. That's basically what I'm doing. I'm still prototyping and wanted to use the I just realised that the |
|
What is the status of this? It received a review, but the necessary action isn't clear to me. |
|
I found a different way to solve my problem (I don't remember how though) and have given up on this PR. Shall I close it or would you be interested in this feature? |
|
I don't need it. Closing it is probably fine. The general advise is to implement standard traits such as |
GreenTokenimplements all traits required to use it as the key type of a hash map. It also implementsBorrow<GreenTokenData>. Thus is would be nice ifGreenTokenDataalso implementedEqandHashsuch that the result ofSyntaxToken::greencould be used for lookups in such a hash map without additional overhead in terms of syntax or runtime.