October 2018
Beginner
180 pages
4h 48m
English
The Not trait enables the logical negation operator, which is written as an !. Not is both conceptually and practically similar to Neg, but its primary use is for Boolean logic rather than arithmetic.
Implementing Not looks like this:
pub enum NotExample { True, False,}impl Not for NotExample { type Output = NotExample; fn not(self) -> NotExample { match self { NotExample::True => NotExample::False, NotExample::False => NotExample::True, } }}
Read now
Unlock full access