title: How can I write a generic function that discriminates between signed and unsigned int?
body: <p>I was wondering if it was possible to discriminate between a signed and unsigned int in Rust. In <code>std::num</code> we have <code>Int</code>, <code>UnsignedInt : Int</code> and <code>SignedInt : Int + Neg</code>, so those two are not mutually exclusive.</p>
  
  <p>In the simplest case, would it be possible to write a simple function <code>fn&lt;T: Int&gt;is_signed(value: T) -&gt; bool</code> that would return true when a signed value is passed (e.g. <code>i32</code>)? Is there a better way of doing this?</p>
  
  <p>Edit in response to a comment below: a real-world example is wrapping a C FFI where functions that return signed integer types indicate an error by returning a <code>-1</code> whereas functions returning uints indicate error by returning <code>0</code> (this, plus it got me interested in what's an idiomatic way of doing it in Rust).</p>