I have some code that is attempting to read in a list of strings into struct values. With the code below, I am attempting to just print the lines from the input_file
vector from inside POLIR::generate_config()
. I am getting the error:
error: expected type, found `{`
--> src/main.rs:5:27
|
5 | for line in args: {
| ^ expecting a type here because of type ascription
What am I doing wrong here?
struct POLIR {}
impl POLIR {
fn generate_config(&self, args: Vec<String>) {
for line in args: {
println!{"{}", line};
}
}
}
fn main() {
//other program stuff
let input_file = lines_from_file(input_file);
let system = POLIR {};
POLIR::generate_config(&system, input_file);
}
This error was solved by removing the colon from
POLIR::generate_config()
: