Skip to main content

CtNeg

Trait CtNeg 

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

    // Provided method
    fn ct_neg_assign(&mut self, choice: Choice) { ... }
}
Expand description

Constant-time conditional negation: negates a value when choice is Choice::TRUE.

Required Methods§

Source

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

Conditionally negate self, returning -self if choice is Choice::TRUE, or self otherwise.

Provided Methods§

Source

fn ct_neg_assign(&mut self, choice: Choice)

Conditionally negate self in-place, replacing it with -self if choice is Choice::TRUE.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl CtNeg for NonZero<i8>

Source§

fn ct_neg(&self, choice: Choice) -> NonZero<i8>

Source§

fn ct_neg_assign(&mut self, choice: Choice)

Source§

impl CtNeg for NonZero<i16>

Source§

fn ct_neg(&self, choice: Choice) -> NonZero<i16>

Source§

fn ct_neg_assign(&mut self, choice: Choice)

Source§

impl CtNeg for NonZero<i32>

Source§

fn ct_neg(&self, choice: Choice) -> NonZero<i32>

Source§

fn ct_neg_assign(&mut self, choice: Choice)

Source§

impl CtNeg for NonZero<i64>

Source§

fn ct_neg(&self, choice: Choice) -> NonZero<i64>

Source§

fn ct_neg_assign(&mut self, choice: Choice)

Source§

impl CtNeg for NonZero<i128>

Source§

fn ct_neg(&self, choice: Choice) -> NonZero<i128>

Source§

fn ct_neg_assign(&mut self, choice: Choice)

Source§

impl CtNeg for NonZero<isize>

Source§

fn ct_neg(&self, choice: Choice) -> NonZero<isize>

Source§

fn ct_neg_assign(&mut self, choice: Choice)

Source§

impl CtNeg for NonZero<u8>

Source§

fn ct_neg(&self, choice: Choice) -> NonZero<u8>

Source§

impl CtNeg for NonZero<u16>

Source§

fn ct_neg(&self, choice: Choice) -> NonZero<u16>

Source§

impl CtNeg for NonZero<u32>

Source§

fn ct_neg(&self, choice: Choice) -> NonZero<u32>

Source§

impl CtNeg for NonZero<u64>

Source§

fn ct_neg(&self, choice: Choice) -> NonZero<u64>

Source§

impl CtNeg for NonZero<u128>

Source§

fn ct_neg(&self, choice: Choice) -> NonZero<u128>

Source§

impl CtNeg for NonZero<usize>

Source§

fn ct_neg(&self, choice: Choice) -> NonZero<usize>

Source§

impl CtNeg for i8

Source§

fn ct_neg(&self, choice: Choice) -> i8

Source§

fn ct_neg_assign(&mut self, choice: Choice)

Source§

impl CtNeg for i16

Source§

fn ct_neg(&self, choice: Choice) -> i16

Source§

fn ct_neg_assign(&mut self, choice: Choice)

Source§

impl CtNeg for i32

Source§

fn ct_neg(&self, choice: Choice) -> i32

Source§

fn ct_neg_assign(&mut self, choice: Choice)

Source§

impl CtNeg for i64

Source§

fn ct_neg(&self, choice: Choice) -> i64

Source§

fn ct_neg_assign(&mut self, choice: Choice)

Source§

impl CtNeg for i128

Source§

fn ct_neg(&self, choice: Choice) -> i128

Source§

fn ct_neg_assign(&mut self, choice: Choice)

Source§

impl CtNeg for isize

Source§

fn ct_neg(&self, choice: Choice) -> isize

Source§

fn ct_neg_assign(&mut self, choice: Choice)

Source§

impl CtNeg for u8

Source§

fn ct_neg(&self, choice: Choice) -> u8

Source§

fn ct_neg_assign(&mut self, choice: Choice)

Source§

impl CtNeg for u16

Source§

fn ct_neg(&self, choice: Choice) -> u16

Source§

fn ct_neg_assign(&mut self, choice: Choice)

Source§

impl CtNeg for u32

Source§

fn ct_neg(&self, choice: Choice) -> u32

Source§

fn ct_neg_assign(&mut self, choice: Choice)

Source§

impl CtNeg for u64

Source§

fn ct_neg(&self, choice: Choice) -> u64

Source§

fn ct_neg_assign(&mut self, choice: Choice)

Source§

impl CtNeg for u128

Source§

fn ct_neg(&self, choice: Choice) -> u128

Source§

fn ct_neg_assign(&mut self, choice: Choice)

Source§

impl CtNeg for usize

Source§

fn ct_neg(&self, choice: Choice) -> usize

Source§

fn ct_neg_assign(&mut self, choice: Choice)

Implementors§