Trait hacspec_lib::prelude::Not

1.0.0 · source · []
pub trait Not {
    type Output;

    fn not(self) -> Self::Output;
}
Expand description

The unary logical negation operator !.

Examples

An implementation of Not for Answer, which enables the use of ! to invert its value.

use std::ops::Not;

#[derive(Debug, PartialEq)]
enum Answer {
    Yes,
    No,
}

impl Not for Answer {
    type Output = Self;

    fn not(self) -> Self::Output {
        match self {
            Answer::Yes => Answer::No,
            Answer::No => Answer::Yes
        }
    }
}

assert_eq!(!Answer::Yes, Answer::No);
assert_eq!(!Answer::No, Answer::Yes);

Required Associated Types

The resulting type after applying the ! operator.

Required Methods

Performs the unary ! operation.

Examples
assert_eq!(!true, false);
assert_eq!(!false, true);
assert_eq!(!1u8, 254);
assert_eq!(!0u8, 255);

Implementors

Bit-wise not operation on the coefficients.

Bit-wise not operation on the coefficients.

Bit-wise not operation on the coefficients.

Bit-wise not operation on the coefficients.

impl Not for State

impl Not for Constants

impl Not for Block

impl Not for ChaChaIV

impl Not for ChaChaKey

impl Not for PolyKey

impl Not for PolyBlock

impl Not for Poly1305Tag

impl Not for FieldCanvas

impl Not for FieldElement

impl Not for State

impl Not for Row

impl Not for Digest224

impl Not for Digest256

impl Not for Digest384

impl Not for Digest512

impl Not for B0

impl Not for B1

impl Not for Block

impl Not for Word

impl Not for RoundKey

impl Not for Nonce

impl Not for SBox

impl Not for RCon

impl Not for Bytes144

impl Not for Bytes176

impl Not for Bytes208

impl Not for Bytes240

impl Not for Key128

impl Not for Key256

impl Not for Block

impl Not for Key

impl Not for Tag

impl Not for DigestB

impl Not for FieldCanvas

impl Not for FieldElement

impl Not for ScalarCanvas

impl Not for Scalar

impl Not for FieldCanvas

impl Not for FieldElement

impl Not for Scalar

impl Not for FieldCanvas

impl Not for FieldElement

impl Not for Scalar

impl Not for Block

impl Not for OpTableType

impl Not for Digest

impl Not for Hash