Elektrine lite

โ† Feed

@janriemer@floss.social

Post #2612501

2023-12-02 19:15 UTC

Whoop! ๐ŸŽ‰ Continuing this series, we'll (very likely) get `dyn (trait) upcasting` in #Rust 1.76! :awesome: ๐ŸŽก I've accidentally stumbled upon this (๐Ÿ˜„), while trying to answer @luna@lunar.place's question here: https://floss.social/@luna@lunar.place/111511081757642056 It basically allows you to upcast trait objects. See the original RFC (with some nice examples on when you need this)...: https://github.com/rust-lang/rfcs/blob/master/text/3324-dyn-upcasting.md ...and it's tracking issue: https://github.com/rust-lang/rust/issues/65991 #RustLang

Replies (2)

  • @luna@lunar.place 2023-12-02 20:17

    @janriemer@floss.social Ooo this is exciting, will this mean that it will work like i expected it to in my post?

    Open ##2612504

  • @Corax42@mastodon.social 2023-12-28 20:32

    @janriemer@floss.social @luna@lunar.place I remember the first time I tried Rust in the playground. Being a boring Java developer, I immediately proceeded to make trait objects and pass them into generic functions. My joy was quickly frustrated; first by learning that pretty much every generic library function has implicit Sized bounds on its type parameters, next by realizing that it was literally impossible to upcast a &dyn. I've made my peace with static dispatch by now, but back then, I was genuinely shocked ^^

    Open ##2612510