(scripts: Vec<Vec<TwilightCommand>>)
| 415 | } |
| 416 | |
| 417 | fn merge_script_commands(scripts: Vec<Vec<TwilightCommand>>) -> Vec<TwilightCommand> { |
| 418 | let mut result = Vec::new(); |
| 419 | |
| 420 | for script_commands in scripts { |
| 421 | for cmd in script_commands { |
| 422 | if let Some(existing) = result |
| 423 | .iter_mut() |
| 424 | .find(|v: &&mut TwilightCommand| v.name == cmd.name) |
| 425 | { |
| 426 | merge_command(existing, cmd); |
| 427 | } else { |
| 428 | result.push(cmd); |
| 429 | } |
| 430 | } |
| 431 | } |
| 432 | |
| 433 | result |
| 434 | } |
| 435 | |
| 436 | // merges src into dst |
| 437 | fn merge_command(dst: &mut TwilightCommand, src: TwilightCommand) { |
no test coverage detected