title: How do I append to a tuple?
body: <p>I have something which I know is a tuple. How do I generically append a single value to the tuple?</p>
  
  <pre class="lang-rust prettyprint-override"><code>let some_tuple: (i32, &amp;str, bool) = (1, "Hello", true);
  
  let with_world: (i32, &amp;str, bool, &amp;str) = some_tuple.append("World");
  </code></pre>
  
  <hr>
  
  <p>As a possible use-case, consider a parser combinator which takes a variadic number of parsers and runs each in sequence, producing a tuple of their attributes:</p>
  
  <pre class="lang-rust prettyprint-override"><code>// Emulate variadic parameters:
  macro_rules! seq {
      ($($parsers:expr),*) =&gt; {
          move |input: &amp;[u8]| {
              let result = ();
              let remaining = input;
              $(
                  let (remaining, parser_result) = $parsers(remaining);
                  let result = result.append(parser_result);
              )*
              result
          }
      }
  }
  </code></pre>
  
  <p>With tuple appending, <code>seq!(a, b, c, d)</code> can yield <code>(A, B, C, D)</code>, rather than the ugly <code>(((A, B), C), D)</code>.</p>