I'm trying to understand how I can solve a particular problem that I have -
I need to have a dynamic (runtime) handler for callbacks from some C++ - this is fine, I can use a dyn trait in a box, put whatever handler I want in there. However, I want to be able to get at the object that I put in there, to pull a type-specific object that it builds from those callbacks back out of it.
So I have:
pub trait CallbackHandler: Any {
fn callback(&mut self, message: &str);
}
pub struct UICallbackProxy {
value: Option<Box<dyn CallbackHandler>>,
}
then:
// JsonValueCollector implements CallbackHandler
ui.callback.value = Some(Box::new(JsonValueCollector{ va