title: I can't build a value of type `Vec<B> from an iterator over elements of type `Vec<B>`
body: <p>The code :</p>
  <pre><code>#[derive(Clone)]
  pub struct  A{
      pub a: Vec&lt;B&gt;
  }
  #[derive(Clone)]
  pub struct  B {
      pub b: Vec&lt;C&gt;
  }
  
  #[derive(Clone)]
  pub struct C{
      pub c :i32
  }
  
  fn main() {
      let c= C{c :1};
      let b = B{b : vec![c]};
      let a = A{a : vec![b]};
      let va = vec![a];
      let ret=va.iter().map(|x| x.a.clone()).collect::&lt;Vec&lt;B&gt;();;
  }
  </code></pre>
  <p><a href="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2021&amp;gist=2219e3297bc28358f9f7ec532f2e5707" rel="nofollow noreferrer">https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2021&amp;gist=2219e3297bc28358f9f7ec532f2e5707</a></p>
  <p>return this error:</p>
  <blockquote>
  <p>error[E0277]: a value of type <code>Vec&lt;B&gt;</code> cannot be built from an iterator over elements of type <code>Vec&lt;B&gt;</code>
  --&gt; src/main.rs:20:44
  |
  20 |     let ret=va.iter().map(|x| x.a.clone()).collect::&lt;Vec&gt;();;
  |                                            ^^^^^^^ value of type <code>Vec&lt;B&gt;</code> cannot be built from <code>std::iter::Iterator&lt;Item=Vec&lt;B&gt;&gt;</code>
  |
  = help: the trait <code>FromIterator&lt;Vec&lt;B&gt;&gt;</code> is not implemented for <code>Vec&lt;B&gt;</code></p>
  </blockquote>
  <p>I don't understand
  <a href="https://doc.rust-lang.org/std/vec/struct.Vec.html#impl-FromIterator%3CT%3E" rel="nofollow noreferrer">https://doc.rust-lang.org/std/vec/struct.Vec.html#impl-FromIterator%3CT%3E</a>
  says that vec implement From Iterator without condition on T</p>