CtSelect

Trait CtSelect 

Source
pub trait CtSelect: Sized {
    // Required method
    fn ct_select(&self, other: &Self, choice: Choice) -> Self;

    // Provided methods
    fn ct_assign(&mut self, other: &Self, choice: Choice) { ... }
    fn ct_swap(&mut self, other: &mut Self, choice: Choice) { ... }
}
Expand description

Constant-time selection: pick between two values based on a given Choice.

Required Methods§

Source

fn ct_select(&self, other: &Self, choice: Choice) -> Self

Select between self and other based on choice, returning a copy of the value.

§Returns

Provided Methods§

Source

fn ct_assign(&mut self, other: &Self, choice: Choice)

Conditionally assign other to self if choice is Choice::TRUE.

Source

fn ct_swap(&mut self, other: &mut Self, choice: Choice)

Conditionally swap self and other if choice is Choice::TRUE.

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.

Implementations on Foreign Types§

Source§

impl CtSelect for Ordering

Source§

fn ct_select(&self, other: &Self, choice: Choice) -> Self

Source§

impl CtSelect for i8

Source§

fn ct_select(&self, other: &Self, choice: Choice) -> Self

Source§

impl CtSelect for i16

Source§

fn ct_select(&self, other: &Self, choice: Choice) -> Self

Source§

impl CtSelect for i32

Source§

fn ct_select(&self, other: &Self, choice: Choice) -> Self

Source§

impl CtSelect for i64

Source§

fn ct_select(&self, other: &Self, choice: Choice) -> Self

Source§

impl CtSelect for i128

Source§

fn ct_select(&self, other: &Self, choice: Choice) -> Self

Source§

impl CtSelect for u8

Source§

fn ct_select(&self, other: &Self, choice: Choice) -> Self

Source§

fn ct_assign(&mut self, other: &Self, choice: Choice)

Source§

impl CtSelect for u16

Source§

fn ct_select(&self, other: &Self, choice: Choice) -> Self

Source§

fn ct_assign(&mut self, other: &Self, choice: Choice)

Source§

impl CtSelect for u32

Source§

fn ct_select(&self, other: &Self, choice: Choice) -> Self

Source§

fn ct_assign(&mut self, other: &Self, choice: Choice)

Source§

impl CtSelect for u64

Source§

fn ct_select(&self, other: &Self, choice: Choice) -> Self

Source§

fn ct_assign(&mut self, other: &Self, choice: Choice)

Source§

impl CtSelect for u128

Source§

fn ct_select(&self, other: &Self, choice: Choice) -> Self

Source§

fn ct_assign(&mut self, other: &Self, choice: Choice)

Source§

impl CtSelect for usize

Available on 32-bit or 64-bit only.
Source§

fn ct_select(&self, other: &Self, choice: Choice) -> Self

Source§

impl<T, const N: usize> CtSelect for [T; N]
where T: CtSelect,

Source§

fn ct_select(&self, other: &Self, choice: Choice) -> Self

Source§

fn ct_assign(&mut self, other: &Self, choice: Choice)

Implementors§