Trait std::ops::NotStable [-]  [+] [src]

pub trait Not {
    type Output;
    fn not(self) -> <Self as Not>::Output;
}

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!.

#![feature(associated_types)] use std::ops::Not; struct Foo; impl Copy for Foo {} impl Not for Foo { type Output = Foo; fn not(self) -> Foo { println!("Not-ing!"); self } } fn main() { !Foo; }
#![feature(associated_types)]

use std::ops::Not;

struct Foo;

impl Copy for Foo {}

impl Not for Foo {
    type Output = Foo;

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

fn main() {
    !Foo;
}

Required Methods

type Output

fn not(self) -> <Self as Not>::Output

The method for the unary ! operator

Implementors