title: Can you implement a generic struct for multiple types?
body: <p>I have a generic struct <code>Dit&lt;T&gt;</code> that implements the FFT for T:</p>
  
  <pre><code>struct Dit&lt;T&gt; {
      n: usize,
      exponents: Bin&lt;f32, Complex&lt;T&gt;&gt;,
      tmp: Option&lt;Vec&lt;Complex&lt;T&gt;&gt;&gt;,
  }
  
  impl Dit&lt;f32&gt; {
      /// Create a new instance
      ///
      /// Notice that the number of samples that will be processed by an instance
      /// is always fixed, because the exponent values are precalculated.
      ///
      /// # Parameters
      /// - `n` The number of samples this operator can process, eg. 1024
      pub fn new(n: usize) -&gt; Result&lt;Dit&lt;f32&gt;, FFTError&gt; {
          if 2.pow((n as f64).log2() as usize) != n {
              return Err(FFTError::InvalidLength);
          }
  
          let rtn = Dit {
              n: n,
              exponents: Bin::new(),
              tmp: None,
          }.pregen();
  
          return Ok(rtn);
      }
  
      // ...
  }
  </code></pre>
  
  <p>I started to add the implementation for <code>f64</code>:</p>
  
  <pre><code>impl Dit&lt;f64&gt; {
      pub fn new(n: usize) -&gt; Result&lt;Dit&lt;f64&gt;, FFTError&gt; {
          unimplemented!()
      }
      // ...
  }
  </code></pre>
  
  <p>...and I'm getting these sorts of errors:</p>
  
  <pre class="lang-none prettyprint-override"><code>src/impls/dit.rs:186:7: 196:4 error: duplicate definition of value `new`
  src/impls/dit.rs:186   pub fn new(n:usize) -&gt; Result&lt;Dit&lt;f64&gt;, FFTError&gt; {
  src/impls/dit.rs:187     if 2.pow((n as f64).log2() as usize) != n {
  src/impls/dit.rs:188       return Err(FFTError::InvalidLength);
  src/impls/dit.rs:189     }
  src/impls/dit.rs:190     let rtn = Dit {
  src/impls/dit.rs:191       n: n,
                       ...
  src/impls/dit.rs:110:7: 120:4 note: first definition of value `new` here
  src/impls/dit.rs:110   pub fn new(n:usize) -&gt; Result&lt;Dit&lt;f32&gt;, FFTError&gt; {
  src/impls/dit.rs:111     if 2.pow((n as f64).log2() as usize) != n {
  src/impls/dit.rs:112       return Err(FFTError::InvalidLength);
  src/impls/dit.rs:113     }
  src/impls/dit.rs:114     let rtn = Dit {
  src/impls/dit.rs:115       n: n,
  </code></pre>
  
  <p>I am confused. My impression was that for the generic <code>Foo&lt;T&gt;</code>, the implementation <code>Foo&lt;Bar1&gt;</code> is a different concrete instance to the implementation of <code>Foo&lt;Bar2&gt;</code>. As such, I was under the impression that I could have different instances of methods for each concrete instance.</p>
  
  <p>What am I doing wrong?</p>