>Wouldn't this work?
https://doc.rust-lang.org/std/mem/fn.swap.htmlIf you click the [src] link on that page, you'll see that the implementation of std::mem::swap uses unsafe. I'm no Rust expert, but I'm also not aware of a way to swap pointers without unsafe.