title: How do I match the type of an expression in a Rust macro?
body: <p>This is just pseudocode:</p>
  
  <pre><code>macro_rules! attribute {
      $e: expr&lt;f32&gt; =&gt; { /* magical float stuff */ };
      $e: expr&lt;i64&gt; =&gt; { /* mystical int stuff */ };
  };
  </code></pre>
  
  <p>I would like to have a differently expanded macro depending on the type that I passed to the macro. </p>
  
  <p>This is how it would work in C++</p>
  
  <pre><code>template &lt;typename T&gt;
  struct Attribute{ void operator(T)() {} };
  
  template &lt;&gt;
  struct Attribute&lt;float&gt; {
      void operator(float)(float) { /* magical float stuff */ }
  };
  
  template &lt;&gt;
  struct Attribute&lt;long&gt; {
      void operator()(long) { /* mystical int stuff */ }
  }
  </code></pre>