title: Is it possible to overload a function with different numbers of arguments (using traits)
body: <p>I'm trying to have a <code>new</code> constructor with one and with two arguments, but I can't seem to figure out how to do this. Is this even possible at the moment?</p>
  
  <p>What I have now gives me an error that multiple applicable items are in scope (<a href="https://play.rust-lang.org/?gist=4a7c13ebcd73abfcebdc5eaaf40d9ad0&amp;version=stable&amp;backtrace=0" rel="noreferrer">playground</a>)</p>
  
  <pre><code>trait __Constructor1&lt;T&gt; {
      fn new(T) -&gt; Self;
  }
  trait __Constructor2&lt;T, U&gt; {
      fn new(T, U) -&gt; Self;
  }
  
  enum MixedInts {
      SmallInt(i32),
      TwoSmallInts(i32, i32),
  }
  
  impl __Constructor1&lt;i32&gt; for MixedInts {
      fn new(__0: i32) -&gt; MixedInts {
          MixedInts::SmallInt(__0)
      }
  }
  impl __Constructor2&lt;i32, i32&gt; for MixedInts {
      fn new(__0: i32, __1: i32) -&gt; MixedInts {
          MixedInts::TwoSmallInts(__0, __1)
      }
  }
  
  fn main() {
      let x = MixedInts::new(2i32);
      let y = MixedInts::new(2i32, 2i32);
  }
  </code></pre>