assert_matches
assert_matches copied to clipboard
Propose this to libstd in an RFC
Hi!
I found myself implementing a very similar macro a few times. I called it assert_pat
, but it did virtually the same thing. Today I thought I should create an RFC proposing that my macro is added to the standard library. I find it very useful and ergonomic whenever you need to assert equality on something that does not implement Eq
, but that can be matched by a destructure. For example, when using error-chain
this is very needed, since the errors generated by that library does not implement Eq
.
However. In my research I found this crate, which is awesome! But have you thought about suggesting it be included in the standard library?
I hadn't considered submitting an RFC for inclusion into std
. If you want to go forward with your RFC, you have my blessing to use this repo's code as a reference implementation.
Partial implementations are in unstable libstd: https://github.com/rust-lang/rust/issues/82775.