minor ownership fix

parent 6a4ca30f
......@@ -40,7 +40,7 @@ impl Employee{
}
}
}
fn employed_on_position(employees:Vec<Employee>, position:Position) -> Vec<Employee>
fn employed_on_position(employees:&Vec<Employee>, position:Position) -> Vec<Employee>
{
let mut on_picked_position:Vec<Employee> = Vec::new();
......@@ -70,11 +70,17 @@ fn main()
position: Position::Designer,
salary: 1200.0,
}];
let managers = employed_on_position(employees, Position::Manager);
let managers = employed_on_position(&employees, Position::Manager);
let developers= employed_on_position(&employees, Position::Developer);
println!("Managers:");
for employee in managers {
println!("\t{} - {} - {}", employee.name, employee.position.position_to_string(), employee.salary);
}
println!("Developers:");
for employee in developers{
println!("\t{} - {} - {}", employee.name, employee.position.position_to_string(), employee.salary);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment