Can I mem::swap two arguments


#1
fn swap(arg1: &mut A, arg2: &mut A) {
    mem::swap(arg1, arg2);
    // Some actions
    mem::swap(arg2, arg1);
}

Can I do it?


#2

Sure. This works just fine, as long as you declare the generic type A:

fn swap<A>(...

Full running program: https://play.rust-lang.org/?gist=8cadbb86c778b4466de6&version=stable


#3

Good. Thanks.