title: "error: trait bounds are not allowed in structure definitions" when attempting to use polymorphism
body: <blockquote>
    <p>Editor's note: This question was asked before Rust 1.0 and before certain features were implemented. The code as-is works today.</p>
  </blockquote>
  
  <p>I'm  writing a board game AI in Rust. There are multiple rulesets for the game and I'd like to have the rules logic separated from the board layout (they are currently mixed). In a language like Ruby, I'd have the separate rule sets implement the same interface. In Rust I thought about using a trait and parameterizing the <code>Board</code> with the ruleset I want to use (e.g. <code>Board&lt;Rules1&gt;::new()</code>). </p>
  
  <p>Saving an object that implements this trait in a struct (like <code>Board</code>) is not allowed. I could turn the <code>Rules</code> into an <code>enum</code>, but it looks a bit messy to me because I can't define separate implementations for the members of the enum. Using pattern matching would work, but that splits the functionality along the function axis and not along the struct axis. Is this just something I have to live with or there some way?</p>
  
  <p>The following code is what I'd like to use:</p>
  
  <pre><code>pub struct Rules1;
  pub struct Rules2;
  
  trait Rules {
      fn move_allowed() -&gt; bool;
  }
  
  impl Rules for Rules1 {
      fn move_allowed() -&gt; bool {
          true
      }
  }
  
  impl Rules for Rules2 {
      fn move_allowed() -&gt; bool {
          false
      }
  }
  
  struct Board&lt;R: Rules&gt; {
      rules: R
  }
  
  fn main() {}
  </code></pre>
  
  <p>It produces the following error:</p>
  
  <pre class="lang-none prettyprint-override"><code>test.rs:20:1: 22:2 error: trait bounds are not allowed in structure definitions
  test.rs:20 struct Board&lt;R: Rules&gt; {
  test.rs:21     rules: R
  test.rs:22 }
  error: aborting due to previous error
  </code></pre>