title: callback on several variables modification
body: <p>I have the variables <code>v1</code>, ..., <code>vn</code>, each one having a unique type <code>T1</code>, ..., <code>Tn</code>. I want to make it possible to subscribe to modifications
  of these variables, not more then 4 at once.</p>
  
  <pre><code>use std::any::Any;
  
  #[derive(Debug)]
  struct T1(f32);
  #[derive(Debug)]
  struct T2(f32);
  
  fn f1(a: &amp;T1, b: &amp;T2) {
      println!("you call f1: a {:?} b {:?}", a, b);
  }
  
  fn main() {
      let mut p1: Box&lt;Any&gt; = Box::new(T1(0.1));
      let mut p2: Box&lt;Any&gt; = Box::new(T2(0.1));
  
      let mut v = vec![p1, p2];
  
      let mut callbacks = ???    
  
      subscribe_on_change(&amp;mut callbacks, T1_id, T2_id, f1);
  
      if let Some(num) = v[0].downcast_mut::&lt;T1&gt;() {
          println!("num: {:?}", num);
          *num = T1(5.1);
          callbacks.update(T1_id);
      }
  }
  </code></pre>
  
  <p>How can I implement such functionality using only the stable or beta compiler?</p>
  
  <p>Because <code>std::any::Any::get_type_id</code> is only usable in the nightly compiler, I can extend <code>Any</code> with my trait, and replace <code>TypeId</code> with my own <code>enum</code>, if there is no more elegant solution.</p>
  
  <p>But what would I put into <code>callbacks</code>, if I want call functions
  with signatures: <code>(&amp;Tk1)</code>, <code>(&amp;Tk1, &amp;Tk2)</code>, <code>(&amp;Tk1, &amp;Tk2, &amp;Tk3)</code>,
  <code>(&amp;Tk1, &amp;Tk2, &amp;Tk3, &amp;Tk4)</code>, where I have at least 10 types,
  so because of each ki != kj, I have 10 + 10 * 9 + 10 * 9 * 8 + 10 * 9 * 8 * 7 variants.</p>
  
  <p>Because it is not clear, I want to call the callbacks if any of the arguments are updated. For example, in the code above, <code>f1</code> should be called if variables of type <code>T1</code> or <code>T2</code> were updated. I have <code>n</code> unique variables, each of them having a unique type and I put then into a <code>Vec&lt;Box&lt;Any&gt;&gt;</code>.</p>