by sam0x17 · 4y ago · 0 comments
#[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.
How? I thought the orphan rule said you can only define trait implantations at struct definition or trait definition
In crystal there is a reasonable data-based default hash implementation that you can just rely on.