title: Make a list of different types in Rust
body: <p>In C# I can make a List and add items of different types to it. As long as they inherit the base class. For example:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  
  class Parent
  {
      public int p;
  
      public Parent(int p)
      {
          this.p = p;
      }
  }
  
  class A : Parent
  {
      public int a;
  
      public A(int p, int a) : base(p)
      {
          this.a = a;
      }
  }
  
  class B : Parent
  {
      public int b;
  
      public B(int p, int b) : base(p)
      {
          this.b = b;
      }
  }
  
  class Program
  {
      static void Main(string[] args)
      {
          List&lt;Parent&gt; list = new List&lt;Parent&gt;();
  
          A a = new A(10, 20);
          B b = new B(30, 40);
          list.Add(a);
          list.Add(b);
  
          A l_a = list[0] as A;
          B l_b = list[1] as B;
  
          Console.WriteLine(String.Format("{0}, {1}", l_a.p, l_a.a)); // 10, 20
          Console.WriteLine(String.Format("{0}, {1}", l_b.p, l_b.b)); // 30, 40
      }
  }
  </code></pre>
  
  <p>Rust is not an object oriented programming language, but I would like to know if something similar could be achieved. Is there a method?</p>