I have a snippet of code that swaps two variables memory, which works fine:
let mut last_input = InputState::default();
let mut current_input = InputState::default();
...
let temp = current_input;
current_input = last_input;
last_input = temp;
However, when I extract the swap logic into a function I get the following errors:
lifetime mismatch... but data from `last_input` flows into `current_input` hererustc E0623 main.rs(168, 57): these two types are declared with different lifetimes... main.rs(168, 28):
I can't figure out how to annotate the lifetimes to tell the borrow checker that this is okay. Any suggestions?