Skip to main content

ConditionallyNegatable

Trait ConditionallyNegatable 

Source
pub trait ConditionallyNegatable {
    // Required method
    fn conditional_negate(&mut self, choice: Choice);
}
Expand description

A type which can be conditionally negated in constant time.

§Note

A generic implementation of ConditionallyNegatable is provided for types T which are ConditionallySelectable and have Neg implemented on &T.

Required Methods§

Source

fn conditional_negate(&mut self, choice: Choice)

Negate self if choice == Choice(1); otherwise, leave it unchanged.

This function should execute in constant time.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T> ConditionallyNegatable for T
where T: ConditionallySelectable, for<'a> &'a T: Neg<Output = T>,