Skip to main content

ConditionallySelectable

Trait ConditionallySelectable 

Source
pub trait ConditionallySelectable: Sized {
    // Required method
    fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self;
}
Expand description

A type which can be conditionally selected with a loose promise of constant time. Compared to subtle::ConditionallySelectable, this trait does not require Copy, but the internal elements should be Copy for the promise to loosely hold.

Required Methods§

Source

fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self

Select a or b according to choice.

§Returns
  • a if choice == Choice(0);
  • b if choice == Choice(1).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§