News for hackers. Stuff that matters.
Re:Improving Rust compile times to enable adoption of memory... by merely-unlikely on Friday February 03, 2023 @11:13AM (#34643072)
I’m still learning the language but couldn’t you use an enum containing two types to accomplish the same thing?
Re:Improving Rust compile times to enable adoption of memory... by nicoburns on Friday February 03, 2023 @02:53PM (#34646878)
You can if you know all of the possible types in advance. But if you want to expose this as an interface from a library that allows users to provide their own custom implementation then you need to use traits.