3Hren/msgpack-rust

Implement PartialEq for rmp_serde errors

makaleks opened this issue · 2 comments

I use custom error using enums and store rmp_serde::encode::Error and rmp_serde::decode::Error inside one of its variants. To use assert_eq! in tests I need to implement PartialEq for this types myself. These errors may worth adding #[derive(PartialEq)], may not they?

These enums may contain io::Error which isn't comparable. You can implement PartialEq manually yourself, or use matches! instead of ==.

@kornelski , thank you, that was surprising for me. Was not familiar with matches!