3 ms·
> Anyone know why there isn't a single type/interface that allows for consumers to supply any of Arc, Rc etc boxed values? Your generic interface just takes a
by loeg 3y ago
> Anyone know why there isn't a single type/interface that allows for consumers to supply any of Arc, Rc etc boxed values?
Your generic interface just takes a reference to the value inside the box.
- adam_arthur 3y agoBorrowing the value didn't work for this case, but forget the reasoning at the moment. This is a struct that may or may not be used in threaded code. Code is highly polymorphic and involves a few traits Using Arc everywhere solves it, but dumb and inefficient for non threaded use cases. Maybe compiler optimizes this though, who knows. Semantically it's wrong though. Honestly forget the specifics enough at this point to discuss so I'll drop it haha. Was just curious whether somebody else was tracking this, or there was a known workaround. I think it's something the language will eventually support. I saw other threads on rustlang asking for the same thing, and best I saw was some sort of enum style hack representing the boxed types to emulate it