2 ms·
> Rust is guilty of this as well, mind you #[derive(Hash)] struct X{ ... } Seems easy enough to me? The only annoyance is if a third party type didn't impleme
by the_duke 4y ago
> Rust is guilty of this as well, mind you
#[derive(Hash)]
struct X{ ... }
Seems easy enough to me? The only annoyance is if a third party type didn't implement Hash, but you can solve that with a manual implementation instead of a derive.
- stonewareslord 4y ago> you can solve that with a manual implementation instead of a derive. How? I thought the orphan rule said you can only define trait implantations at struct definition or trait definition
- sam0x17 4y agoding ding ding! This has been a problem for me a number of times. The quick workaround is pray that it implements Debug and in a reasonable way and take the hash of the string instead
- the_duke 4y agoYeah, for foreign types you will have to use the "newtype" pattern, aka: define your own wrapper struct.