use std::rc::Rc;
use core::any::Any;
pub trait AnimalT {}
fn foo (ptr: Rc<Any>) -> Option<Rc<AnimalT>> {
ptr.downcast::<AnimalT>().ok()
}
gets error:
error: the `downcast` method cannot be invoked on a trait object
--> src/lib.rs:10:9
|
10 | ptr.downcast::<AnimalT>().ok()
| ^^^^^^^^
error: aborting due to previous error; 3 warnings emitted
error: could not compile `playground`.
Is Rc<Any> -> Option<Rc<AnimalT>>
possible at all?