pub struct CtChoice(Word);Expand description
A boolean value returned by constant-time const fns.
Tuple Fields§
§0: WordImplementations§
Source§impl CtChoice
 
impl CtChoice
Sourcepub(crate) const fn from_mask(value: Word) -> Self
 
pub(crate) const fn from_mask(value: Word) -> Self
Returns the truthy value if value == Word::MAX, and the falsy value if value == 0.
Panics for other values.
Sourcepub(crate) const fn from_lsb(value: Word) -> Self
 
pub(crate) const fn from_lsb(value: Word) -> Self
Returns the truthy value if value == 1, and the falsy value if value == 0.
Panics for other values.
Sourcepub(crate) const fn from_usize_being_nonzero(value: usize) -> Self
 
pub(crate) const fn from_usize_being_nonzero(value: usize) -> Self
Returns the truthy value if value != 0, and the falsy value otherwise.
Sourcepub(crate) const fn from_usize_equality(x: usize, y: usize) -> Self
 
pub(crate) const fn from_usize_equality(x: usize, y: usize) -> Self
Returns the truthy value if x == y, and the falsy value otherwise.
Sourcepub(crate) const fn from_usize_lt(x: usize, y: usize) -> Self
 
pub(crate) const fn from_usize_lt(x: usize, y: usize) -> Self
Returns the truthy value if x < y, and the falsy value otherwise.
pub(crate) const fn not(&self) -> Self
pub(crate) const fn or(&self, other: Self) -> Self
pub(crate) const fn and(&self, other: Self) -> Self
Sourcepub(crate) const fn select(&self, a: Word, b: Word) -> Word
 
pub(crate) const fn select(&self, a: Word, b: Word) -> Word
Return b if self is truthy, otherwise return a.
Sourcepub(crate) const fn if_true(&self, x: Word) -> Word
 
pub(crate) const fn if_true(&self, x: Word) -> Word
Return x if self is truthy, otherwise return 0.
pub(crate) const fn is_true_vartime(&self) -> bool
pub(crate) const fn to_u8(self) -> u8
Trait Implementations§
impl Copy for CtChoice
Auto Trait Implementations§
impl Freeze for CtChoice
impl RefUnwindSafe for CtChoice
impl Send for CtChoice
impl Sync for CtChoice
impl Unpin for CtChoice
impl UnwindSafe for CtChoice
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
 
impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more