[−][src]Trait subtle::ConditionallySelectable
Select one of two inputs according to a Choice in constant time.
Examples
use subtle::ConditionallySelectable; use subtle::Choice; let a: i32 = 5; let b: i32 = 13; assert_eq!(i32::conditional_select(&a, &b, Choice::from(0)), a); assert_eq!(i32::conditional_select(&a, &b, Choice::from(1)), b);
Required methods
fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self
Select a or b according to choice.
Returns
aifchoice == Choice(0);bifchoice == Choice(1).
This function should execute in constant time.