Not

The unary logical negation operator !. # ExamplesAn implementation of Not for Answer, which enables the use of ! to invert its value.

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

impl AnswerNot of Not<Answer> {
    fn not(a: Answer) -> Answer {
        match a {
            Answer::Yes => Answer::No,
            Answer::No => Answer::Yes,
        }
    }
}

assert!(!Answer::Yes == Answer::No);
assert!(!Answer::No == Answer::Yes);

Fully qualified path: core::traits::Not

pub trait Not<T>

Trait functions

not

Performs the unary ! operation. # Examples

assert!(!true == false);
assert!(!false == true);

Fully qualified path: core::traits::Not::not

fn not(a: T) -> T