Closed GregoryConrad closed 10 months ago
I think the best path forward is to drop the From
impl and instead expose two methods:
CapsuleKey::static()
CapsuleKey::dynamic<T: ...>(key: T)
This makes the API less ergonomic, but it'll at least be clear what is happening. Maybe the From
impl can come back in the future if specialization ever lands.
This is even more annoying. static
is a keyword so it can't be used as a function name. I also don't want to make the enum public because:
All of these options suck.
For now, I think the best course of action is to just exclude the Hash
bound and call it a day. When/if specialization ever becomes a thing, we can add the Hash bound then.
I thought this was a one-line fix with
#derive
but apparently not. I'm running into an issue with this now:That's a little annoying. I can remove any one of the derived traits and then it compiles fine, but that really feels like a hack. I want to keep that From impl since it is really handy, so I am wondering if I should just drop the
Hash
impl so it all still compiles fine. Looked some more into this, and it is an issue of specialization, which has been an open issue for 8 years or so with no significant progress that I could see. So, I either need to:From
impl (which sucks, but what can you do)Not sure on the best path forward here.