News for hackers. Stuff that matters.
Re:Rust 2024 the Year of Everywhere? by pjmlp on Friday September 23, 2022 @05:42AM (#32949771)
I am only listening some of the concepts that I find harder to grasp, regardless of the context.

Macros are easier than GAT, maybe, there is a whole talk how serde goes crazy with macros.

PhantomData or Pin are hard to grasp, not as concept, rather to keep track when they are needed, many times it isn't clear that the way to fix some compilation error is to plug one of those types. A bit like having to do references to constant literals as well, another gotcha.

Re:Rust 2024 the Year of Everywhere? by estebank on Friday September 23, 2022 @07:46AM (#32950579)
If you encounter a case where the solution to a problem was PhantomData or Pin, and the compiler doesn't flat out tell you that, file a ticket.
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.