antouhou / rs-merkle

The most advanced Merkle tree library for Rust
MIT License
168 stars 45 forks source link

Derive Eq and PartialEq on MerkleProof. #15

Closed tmpfs closed 2 years ago

tmpfs commented 2 years ago

Thanks for the library, it's working really well for me so far 👍

I have a use case where I am using axum and it's TypedHeader struct and I want to decode a header to a struct that includes a MerkleProof::<Sha256> but I can't as it does not implement Eq or PartialEq. I would be able to workaround this by storing a Vec<u8> and lazily decoding to MerkleProof elsewhere in the code but that is awkward.

This small change derives Debug, Eq and PartialEq for MerkleProof. All tests continue to pass.

tmpfs commented 2 years ago

Actually, I realized that it was my error deriving Eq and PartialEq on my TypedHeader implementation, I can do without it.

Closing this as not necessary.