Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
Phantom Types in Rust
(
greyblake.com
)
34 points
by
Stampo00
on Oct 16, 2021
|
hide
|
past
|
favorite
|
3 comments
ridiculous_fish
on Oct 17, 2021
[–]
What if Unit<T> is an enum? Where do you put the PhantomData?
kangalioo
on Oct 17, 2021
|
parent
|
next
[–]
You could put it in any of the variants I think, or make a wrapper struct (like the other comment suggested). As long as the PhantomData comes up somewhere, it should be fine
dwattttt
on Oct 17, 2021
|
parent
|
prev
[–]
Superficially, you'd wrap the enum in a struct, and put the PhantomData there. I'm not sure that makes sense for this example though.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: