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§
Sourcefn ct_select(&self, other: &Self, choice: Choice) -> Self
fn ct_select(&self, other: &Self, choice: Choice) -> Self
Select between self and other based on choice, returning a copy of the value.
§Returns
selfifchoiceisChoice::FALSE.otherifchoiceisChoice::TRUE.
Provided Methods§
Sourcefn ct_assign(&mut self, other: &Self, choice: Choice)
fn ct_assign(&mut self, other: &Self, choice: Choice)
Conditionally assign other to self if choice is Choice::TRUE.
Sourcefn ct_swap(&mut self, other: &mut Self, choice: Choice)
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.