title: Is it possible to check if an object implements a trait at runtime?
body: <pre><code>trait Actor{
      fn actor(&amp;self);
  }
  trait Health{
      fn health(&amp;self);
  }
  struct Plant;
  impl Actor for Plant{
      fn actor(&amp;self){
          println!("Plant Actor");
      }
  }
  struct Monster{
      health: f32
  }
  impl Actor for Monster{
      fn actor(&amp;self){
          println!("Monster Actor");
      }
  }
  impl Health for Monster{
      fn health(&amp;self){
          println!("Health: {}",self.health);
      }
  }
  fn main() {
      let plant = Box::new(Plant);
      let monster = Box::new(Monster{health: 100f32});
  
      let mut actors : Vec&lt;Box&lt;Actor&gt;&gt; = Vec::new();
      actors.push(plant);
      actors.push(monster);
  
      for a in &amp;actors{
          a.actor();
          /* Would this be possible?
          let health = a.get_trait_object::&lt;Health&gt;();
          match health{
              Some(h) =&gt; {h.health();},
              None =&gt; {println!("Has no Health trait");}
          }
          */
      }
  }
  </code></pre>
  
  <p>I am wondering if something like this could be possible?</p>
  
  <pre><code>let health = a.get_trait_object::&lt;Health&gt;();
  match health{
      Some(h) =&gt; {h.health();},
      None =&gt; {println!("Has no Health trait");}
  }
  </code></pre>