Function std::mem::swapStable
[-]
[+]
[src]
pub fn swap<T>(x: &mut T, y: &mut T)
Swap the values at two mutable locations of the same type, without deinitialising or copying either one.
Examples
fn main() { use std::mem; let x = &mut 5i; let y = &mut 42i; mem::swap(x, y); assert_eq!(42i, *x); assert_eq!(5i, *y); }use std::mem; let x = &mut 5i; let y = &mut 42i; mem::swap(x, y); assert_eq!(42i, *x); assert_eq!(5i, *y);