Trait core::ops::NotExperimental [-]  [+] [src]

pub trait Not<Result> {
    fn not(self) -> Result;
}

The Not trait is used to specify the functionality of unary !.

Example

A trivial implementation of Not. When !Foo happens, it ends up calling not, and therefore, main prints Not-ing!.

struct Foo; impl Copy for Foo {} impl Not<Foo> for Foo { fn not(self) -> Foo { println!("Not-ing!"); self } } fn main() { !Foo; }
struct Foo;

impl Copy for Foo {}

impl Not<Foo> for Foo {
    fn not(self) -> Foo {
        println!("Not-ing!");
        self
    }
}

fn main() {
    !Foo;
}

Required Methods

fn not(self) -> Result

The method for the unary ! operator

Implementors