Vec<&YourTrait> not working?
if it's any help, since you're doing this w/ rayon: - trait object must have +Sync included, e.g. Box<YourTrait+Sync> - trait object must be owned, not borrowed (no &dyn) b/c Rust can't assume the owner will outlive the borrowing threads. go with: Arc<Vec<Box<YourTrait+Sync>>>
-
-
This Tweet is unavailable.
-
Sync is just a compile-time safety check, saying you can't send types like &Rc between threads. The only sync cost is atomic refcount increment when you .clone() the Arc<..>, which should be once up front per thread. Locking always happens explicitly in Rust (mutex.lock()).
- Show replies
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
cognitive psychology. PhD