Re:Why I Don't Like Golang (2016)
by stonewareslord on Tuesday June 14, 2022 @12:31PM
(#31741870)
> 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
Yeah, for foreign types you will have to use the "newtype" pattern, aka: define your own wrapper struct.
#[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.