I have a library that needs things to implement a specific trait (TQDispatch
).
In my main project I have a vector of objects that all implement a different trait (Device
) which I need for dynamic dispatch.
The device trait is declared
pub trait Device: TQDispatch{..}
My expectation is that I can take an item from the list of Device
implementers and get at its TQDispatch
-ness so that I can pass it to the library. Given that anything that implements Device
also implements TQDispatch
, this seems like it should be possible.
I can cast the original 'real' object to either, but I cannot find how to cast between the two traits.
Clarification: These are Arc<dyn Device>
in my project vector and I need them to be Arc<dyn TQDispatch>
for the library.