I found this answer to a related question, but it does not help me. According to my understanding the following code should work:
container_options
is not just a mutable reference, it is owned. I should be able to extract a mutable reference to it or even just edit it directly, but the compiler refuses to accept anything I tried. I have no idea where the problem is and hope that someone else does.
Edit: I kinda found a workaround, so this is solved.
fn update_container_options_with_paths(
container_options: Vec<ContainerOption>,
path_options: &Vec<Rc<PathOption>>,
) {
for container_index in 0..container_options.len() {
let container_option = &mut container_options[container_index];
container_option.compatible_path_options = 0;
for (path_index, path_option) in path_options.iter().enumerate() {
if PathOption::decode_loading_mask(
path_option.summary.compatible_container_options,
container_index,
) {
container_option.set_compatible(path_index);
}
}
}
}