Trait subtle::ConditionallyAssignable[][src]

pub trait ConditionallyAssignable {
    fn conditional_assign(&mut self, other: &Self, choice: Choice);
}

A type which can be conditionally assigned in constant time.

Required Methods

Conditionally assign other to self, according to choice.

This function should execute in constant time.

Examples

use subtle::ConditionallyAssignable;
let mut x: u8 = 13;
let y:     u8 = 42;

x.conditional_assign(&y, 0.into());
assert_eq!(x, 13);
x.conditional_assign(&y, 1.into());
assert_eq!(x, 42);

Implementors