the first thread was in
Rust vs Go new thread
Other urls found in this thread:
benchmarksgame-team.pages.debian.net
techempower.com
rust-lang.org
youtube.com
twitter.com
Reminder that node.js bootcamp babies can fuck off
I agree, the same for goshit low IQ retards like you
only low IQ here is you, webshit baby
both are gay languages, learn a real language you nancy
not true, I design floating-point units for a living, unlike you, 5$/hour upwork retard
...
Having worked with Rust for quite some time, trait objects are quite literally useless. At least in go you can object.(Interface) or object.(Type) to 'get it back out'.
In Rust, once you have a Box it's stuck there. You're limited to only the functions of Trait, you cannot specify additional traits ala Box, and you cannot get it back out back to its original type unless you use Box, which elides ALL type information, meaning you cannot perform operations on it - and you can only get back the original, concrete type (if you know it in the first place, which largely limits its use again).
Is it possible to make your trait inherit Any? But yes, you're right. Rust trait objects are pretty terrible. Type assertions for trait objects should be pretty easy to figure out even without Any.
>Is it possible to make your trait inherit Any?
Any is implicitly implemented for everything. What one needs is specifically an Any trait object, not any trait object that implements Any.
In order to downcast you need specifically Box, &Any, or &mut Any.