You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Our use of Vec<Arc<dyn Listener>> and the fact that Listener implementations usually have Weaks mean that most listeners are stored and invoked with double indirection (or triple if you count the Vec). Can we use an inline-boxed-trait-object type (or dyn*, experimentally?) so as to avoid the double indirection? objectionable is a library that claims to provide an InlineBox type which does what we need for that, but I have not tried actually using it.
Another strategy would be a "Vec of unsized elements" container, of which there are a couple experimental ones to be found:
However, using this would come at the cost of some awkward API (until such time as CoerceUnsized is stable) and we could no longer have dyn Listen (because the concrete type would have to be passed generically all the way to the Notifier all the time).
The text was updated successfully, but these errors were encountered:
The current state of unstable dyn* is that Rc, Arc, Weak cannot be used in it, and changing that is not quite as simple as adding the necessary impls to alloc. Filed rust-lang/rust#134591 for that.
Our use of
Vec<Arc<dyn Listener>>
and the fact thatListener
implementations usually haveWeak
s mean that most listeners are stored and invoked with double indirection (or triple if you count theVec
). Can we use an inline-boxed-trait-object type (ordyn*
, experimentally?) so as to avoid the double indirection?objectionable
is a library that claims to provide anInlineBox
type which does what we need for that, but I have not tried actually using it.Another strategy would be a "Vec of unsized elements" container, of which there are a couple experimental ones to be found:
However, using this would come at the cost of some awkward API (until such time as
CoerceUnsized
is stable) and we could no longer havedyn Listen
(because the concrete type would have to be passed generically all the way to theNotifier
all the time).The text was updated successfully, but these errors were encountered: