title: Is it possible to concatenate iterators?
body: <pre><code>let vec = iter::repeat("don't satisfy condition 1") // iterator such as next() always "don't " satisfy condition 1"
      .take_while(|_| {
          satisfycondition1.satisfy() // true is condition 1 is satisfied else false
      })
      .collect();
  </code></pre>
  
  <p>This code creates a vector of <code>n</code> elements with <code>n</code> equal to the number of times condition 1 is not respected.</p>
  
  <p>I would like now to create a vector of <code>n + m</code> elements with <code>n</code> equal to the number of times that condition 1 is not respected and <code>m</code> the number of times that condition 2 is not respected.</p>
  
  <p>The code should resemble something like this:</p>
  
  <pre><code>let vec = iter::repeat("dont't satisfy condition 1")
      .take_while(|_| {
          satisfycondition1.satisfy() 
      })
      .union(
          iter::repeat("has satisfed condition 1 but not 2 yet")
          .take_while(|_| {
              satisfycondition2.satisfy() 
          })
      )
      .collect();
  </code></pre>
  
  <p>I know I could create two vectors and then concatenate them but it's less efficient.</p>
  
  <p>You can use this code to understand what does repeat:</p>
  
  <pre><code>use  std::iter;
  
  fn main() {
      let mut c = 0;
      let z: Vec&lt;_&gt; = iter::repeat("dont't satisfy condition 1")
          .take_while(|_| {
              c = c + 1;
              let rep = if c &lt; 5 { true } else { false };
              rep
          })
          .collect();
      println!("------{:?}", z);
  }
  </code></pre>