Trait snarkvm_circuit::environment::prelude::Not
1.0.0 · source · pub trait Not {
type Output;
// Required method
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§
Required Methods§
Trait Implementations§
§impl<E, I> Metrics<dyn Not<Output = Integer<E, I>>> for Integer<E, I>where
E: Environment,
I: IntegerType,
impl<E, I> Metrics<dyn Not<Output = Integer<E, I>>> for Integer<E, I>where E: Environment, I: IntegerType,
§impl<E> OutputMode<dyn Not<Output = Boolean<E>>> for Boolean<E>where
E: Environment,
impl<E> OutputMode<dyn Not<Output = Boolean<E>>> for Boolean<E>where E: Environment,
§impl<E, I> OutputMode<dyn Not<Output = Integer<E, I>>> for Integer<E, I>where
E: Environment,
I: IntegerType,
impl<E, I> OutputMode<dyn Not<Output = Integer<E, I>>> for Integer<E, I>where E: Environment, I: IntegerType,
type Case = Mode
§fn output_mode(
case: &<Integer<E, I> as OutputMode<dyn Not<Output = Integer<E, I>>>>::Case
) -> Mode
fn output_mode( case: &<Integer<E, I> as OutputMode<dyn Not<Output = Integer<E, I>>>>::Case ) -> Mode
Returns the mode of the output.