Skip to content

Instantly share code, notes, and snippets.

@nicholasf
Created December 20, 2016 04:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicholasf/e368f49dfe7bd8d853b3b66c3462b46a to your computer and use it in GitHub Desktop.
Save nicholasf/e368f49dfe7bd8d853b3b66c3462b46a to your computer and use it in GitHub Desktop.
fn generate_csv(log: String) -> Vec<String> {
let mut log_lines: Vec<&str> = log.split("- -").collect();
for line in log_lines {
match parse_log_into_csv(line.to_string()) {
Ok(csv_line) => {
println!("{}", csv_line);
}
Err(err) => {
println!("Malformed!");
}
}
}
}
/// compile error:
error[E0308]: mismatched types
--> src/main.rs:63:5
|
63 | for line in log_lines {
| ^ expected struct `std::vec::Vec`, found ()
|
= note: expected type `std::vec::Vec<std::string::String>`
= note: found type `()`
/// but I am working off as an example: https://doc.rust-lang.org/std/string/struct.String.html#examples-46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment