Re:Rust 2024 the Year of Everywhere?
by Ygg2 on Friday September 23, 2022 @08:30AM
(#32951004)
> PhantomData
Usually when you want to give type some information it wouldn't normaly have. Like e.g. using it to store generic type signature for some kind of SQL builder. or to keep a lifetime that would otherwise be unbound.
> Pin
Just for self-referential structs. Since async relies on self-referential, it might also require it.
---
When to use it? When you either exhaust all other options or know enough to judge it worthwhile.
Usually when you want to give type some information it wouldn't normaly have. Like e.g. using it to store generic type signature for some kind of SQL builder. or to keep a lifetime that would otherwise be unbound.
> Pin
Just for self-referential structs. Since async relies on self-referential, it might also require it.
---
When to use it? When you either exhaust all other options or know enough to judge it worthwhile.