trait Actor{
fn actor(&self);
}
trait Health{
fn health(&self);
}
struct Plant;
impl Actor for Plant{
fn actor(&self){
println!(\"Pla
As of 1.0, no. Rust doesn't provide any dynamic downcasting support, with the exception of Any
; however, that only allows you to downcast to a value's specific concrete type, not to arbitrary traits that said concrete type implements.
I believe you could implement such casting manually, but that would require unsafe code that would be easy to get wrong; not the sort of thing I want to try and summarise in an SO answer.