My task: get all filenames and sosrting it's fiels
My source code:
extern crate csv;
use std::fs;
use std::string::String;
fn main() {
let paths: Vec<_> = fs::read_dir("test_data").unwrap().cloned().collect().sort();
}
Errors:
Compiling moex_analytic_rust v0.0.1 (file:///home/dmitry/web/moex_analytic_rust)
src/main.rs:9:60: 9:68 error: type mismatch resolving `<std::fs::ReadDir as core::iter::Iterator>::Item == &_`:
expected enum `core::result::Result`,
found &-ptr [E0271]
src/main.rs:9 let paths: Vec<_> = fs::read_dir("test_data").unwrap().cloned().collect().sort();
^~~~~~~~
src/main.rs:9:60: 9:68 help: run `rustc --explain E0271` to see a detailed explanation
src/main.rs:9:69: 9:78 error: no method named `collect` found for type `core::iter::Cloned<std::fs::ReadDir>` in the current scope
src/main.rs:9 let paths: Vec<_> = fs::read_dir("test_data").unwrap().cloned().collect().sort();
^~~~~~~~~
src/main.rs:9:69: 9:78 note: the method `collect` exists but the following trait bounds were not satisfied: `core::iter::Cloned<std::fs::ReadDir> : core::iter::Iterator`
error: aborting due to 2 previous errors
Could not compile `moex_analytic_rust`.
To learn more, run the command again with --verbose.