Hoverbear / hoverbear.org

Sources for hoverbear.org
http://hoverbear.org/
3 stars 2 forks source link

Minor Fix In Iterators VecDeque Example #12

Closed el10savio closed 3 years ago

el10savio commented 3 years ago

This PR makes the change of adding "use" to the std::collections::VecDeque import (located in content/blog/2015-05-02-a-journey-into-iterators/index.md) so that the code compiles fine.

Previously since the use was not included the compile would fail with an error:

error: expected one of `!` or `::`, found `;`
 --> src/main.rs:1:27
  |
1 | std::collections::VecDeque;
  |                           ^ expected one of `!` or `::`

Reference: Playground

With the fix now the VecDeque compiles & runs fine:

Standard Error

   Compiling playground v0.0.1 (/playground)
    Finished dev [unoptimized + debuginfo] target(s) in 1.06s
     Running `target/debug/playground`

Standard Output

[2, 4, 6]

Refrence: Playground

Hoverbear commented 3 years ago

Thank you so much, @el10savio :) I really appreciate you taking the time to improve this for future readers.

el10savio commented 3 years ago

Thank you! Also, awesome post on iterators. It was really fun to go through the code examples :)