Vec<&YourTrait> not working?
-
This Tweet is unavailable.
-
This Tweet is unavailable.
-
-
This Tweet is unavailable.
-
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>>>
0 replies 0 retweets 0 likes -
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()).
1 reply 0 retweets 0 likes
Unlike C++, where I once deadlocked the numpy C++ API b/c C++ implicitly locks a mutex while initializing static variables... never again
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