title: How do I implement the Fn trait for one struct for different types of arguments?
body: <p>I have a simple classifier:</p>
  
  <pre><code>struct Clf {
      x: f64,
  }
  </code></pre>
  
  <p>The classifier returns 0 if the observed value is smaller than <code>x</code> and 1 if bigger than <code>x</code>.</p>
  
  <p>I want to implement the call operator for this classifier. However, the function should be able to take either a float or a vector as arguments. In case of a vector, the output is a vector of 0 or 1 which has the same size as the input vector:</p>
  
  <pre><code>let c = Clf { x: 0 };
  let v = vec![-1, 0.5, 1];
  println!("{}", c(0.5));   // prints 1
  println!("{}", c(v));     // prints [0, 1, 1]
  </code></pre>
  
  <p>How can I write implementation of <code>Fn</code> in this case? </p>
  
  <pre><code>impl Fn for Clf {
      extern "rust-call" fn call(/*...*/) {
          // ...
      }
  }
  </code></pre>