conditional_swap

Function conditional_swap 

Source
pub fn conditional_swap<T: Clone>(a: &mut T, b: &mut T, condition: bool)
Expand description

Constant-time conditional swap

Swaps a and b if condition is true, otherwise leaves them unchanged. Does not branch on the condition value.