Macro aoko::swap [−][src]
macro_rules! swap {
($($a : ident, $b : ident) ; * $(;) ?) => { ... };
}
Expand description
Swaps two variables’ value.
Principles
Shadowing by two immutable variables.
Examples
use aoko::swap;
let (a, b, c, d) = (1, 2, 3, 4);
swap!(a, b; c, d;);
assert_eq!((a, b, c, d), (2, 1, 4, 3));