comrak
comrak copied to clipboard
Implementing PartialEq for Ast
I'm writing a program that needs to translate the comrak AST into a different AST, that a WYSIWYG editor (prosemirror) understands, and back again. I was about to write some tests for this translation, but I found that the Ast
struct doesn't implement PartialEq:
error[E0369]: binary operation `==` cannot be applied to type `Ast`
--> src/prosemirror.rs:105:9
|
105 | assert_eq!(*expected_comrak.data.borrow(), *actual_comrak.data.borrow());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| Ast
| Ast
|
= note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
Maybe there is there a reason for this that I'm missing? If not, would you consider a pull request that adds this? Would be happy to contribute the change.
I did notice there is a same_node
function on Node
but it seems this is for checking if two nodes point to literally the same data.
PS. Thanks for maintaining this library!
I'd be totally happy to accept such a PR!