Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why was PartialEq derive removed from DecodeError? #590

Closed
reinhardbluelab opened this issue Oct 5, 2022 · 2 comments
Closed

Why was PartialEq derive removed from DecodeError? #590

reinhardbluelab opened this issue Oct 5, 2022 · 2 comments

Comments

@reinhardbluelab
Copy link

I had a unit test that compared the returned value of bincode::decode_from_slice (using assert_eq!), but since derive PartialEq was removed from DecodeError in 2.0.0-rc2 this causes an error: Binary operation == cannot be applied to type.

Shouldn't DecodeError derive the PartialEq or Eq trait so that DecodeError instances can be compared?

@VictorKoenders
Copy link
Contributor

VictorKoenders commented Oct 5, 2022

rc-1 was incorrectly dropping underlying std::io::Errors, so those had to be added to the DecodeError as variants (#574). Because std::io::Error does not implement PartialEq or Eq we cannot auto-derive it ourselves.

I personally think that std::io::Error should implement more traits (Eq, PartialEq, Clone, etc) but this should be taken up with the rust-lang devs

@reinhardbluelab
Copy link
Author

Thanks for the explanation. Interestingly, I see that that std::io::ErrorKind derives some of those traits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants