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", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl CtNeg for i8

Source§

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

Source§

fn ct_neg_assign(&mut self, choice: Choice)

Source§

impl CtNeg for i16

Source§

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

Source§

fn ct_neg_assign(&mut self, choice: Choice)

Source§

impl CtNeg for i32

Source§

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

Source§

fn ct_neg_assign(&mut self, choice: Choice)

Source§

impl CtNeg for i64

Source§

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

Source§

fn ct_neg_assign(&mut self, choice: Choice)

Source§

impl CtNeg for i128

Source§

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

Source§

fn ct_neg_assign(&mut self, choice: Choice)

Source§

impl CtNeg for u8

Source§

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

Source§

fn ct_neg_assign(&mut self, choice: Choice)

Source§

impl CtNeg for u16

Source§

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

Source§

fn ct_neg_assign(&mut self, choice: Choice)

Source§

impl CtNeg for u32

Source§

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

Source§

fn ct_neg_assign(&mut self, choice: Choice)

Source§

impl CtNeg for u64

Source§

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

Source§

fn ct_neg_assign(&mut self, choice: Choice)

Source§

impl CtNeg for u128

Source§

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

Source§

fn ct_neg_assign(&mut self, choice: Choice)

Source§

impl CtNeg for NonZeroI8

Source§

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

Source§

fn ct_neg_assign(&mut self, choice: Choice)

Source§

impl CtNeg for NonZeroI16

Source§

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

Source§

fn ct_neg_assign(&mut self, choice: Choice)

Source§

impl CtNeg for NonZeroI32

Source§

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

Source§

fn ct_neg_assign(&mut self, choice: Choice)

Source§

impl CtNeg for NonZeroI64

Source§

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

Source§

fn ct_neg_assign(&mut self, choice: Choice)

Source§

impl CtNeg for NonZeroI128

Source§

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

Source§

fn ct_neg_assign(&mut self, choice: Choice)

Source§

impl CtNeg for NonZeroU8

Source§

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

Source§

impl CtNeg for NonZeroU16

Source§

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

Source§

impl CtNeg for NonZeroU32

Source§

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

Source§

impl CtNeg for NonZeroU64

Source§

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

Source§

impl CtNeg for NonZeroU128

Source§

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

Implementors§