Trait subtle::ConditionallySelectable [−][src]
pub trait ConditionallySelectable {
fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self;
}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.
Implementations on Foreign Types
impl ConditionallySelectable for u8[src]
impl ConditionallySelectable for u8fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self[src]
fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Selfimpl ConditionallySelectable for i8[src]
impl ConditionallySelectable for i8fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self[src]
fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Selfimpl ConditionallySelectable for u16[src]
impl ConditionallySelectable for u16fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self[src]
fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Selfimpl ConditionallySelectable for i16[src]
impl ConditionallySelectable for i16fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self[src]
fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Selfimpl ConditionallySelectable for u32[src]
impl ConditionallySelectable for u32fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self[src]
fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Selfimpl ConditionallySelectable for i32[src]
impl ConditionallySelectable for i32fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self[src]
fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Selfimpl ConditionallySelectable for u64[src]
impl ConditionallySelectable for u64fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self[src]
fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Selfimpl ConditionallySelectable for i64[src]
impl ConditionallySelectable for i64fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self[src]
fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Selfimpl ConditionallySelectable for u128[src]
impl ConditionallySelectable for u128fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self[src]
fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Selfimpl ConditionallySelectable for i128[src]
impl ConditionallySelectable for i128fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self[src]
fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self