|
|
Log in / Subscribe / Register

Existential types in Rust

Existential types in Rust

Posted Apr 24, 2024 16:36 UTC (Wed) by tialaramex (subscriber, #21167)
In reply to: Existential types in Rust by mb
Parent article: Existential types in Rust

Yes, that's not really an existential type, and we can tell because if we try to use it with different types it works - the compiler will just monomorphize your function again with the new type because this is just generics.

Here's a Jon Gjengset talk about all the places we can write "impl Trait" and they mean different things. Jon talks about the "Existential types" as Return Position Impl Trait, RPIT in 1.26. He literally says this is Existential Types about 3 minutes in.

https://www.youtube.com/watch?v=CWiz_RtA1Hw

The Argument Position Impl Trait APIT is really easy and so doesn't take long in the video - it's possible to watch the video distractedly and not realise Jon even mentioned APIT because it's like "Here's what this does, that was boring, it's just a generic with easy syntax", it is not an Existential.


to post comments

Existential types in Rust

Posted Apr 24, 2024 16:48 UTC (Wed) by mb (subscriber, #50428) [Link]

>Return Position Impl Trait

Ah, yes. Thanks for explaining. I remember now that I heard that name before.


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds