# Trait core::ops::Not 1.0.0 [−] [src]

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

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

# 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 = Answer;

        fn not(self) -> Answer {
            match self {
                Answer::Yes => Answer::No,
                Answer::No => Answer::Yes
            }
        }
    }

    assert_eq!(!Answer::Yes, Answer::No);
    assert_eq!(!Answer::No, Answer::Yes);Run

## Associated Types

### `type Output`

The resulting type after applying the `!` operator

## Required Methods

### `fn not(self) -> Self::Output`

The method for the unary `!` operator

## Implementors

- `impl Not for Wrapping<usize>`
- `impl<'a> Not for &'a Wrapping<usize>`
- `impl Not for Wrapping<u8>`
- `impl<'a> Not for &'a Wrapping<u8>`
- `impl Not for Wrapping<u16>`
- `impl<'a> Not for &'a Wrapping<u16>`
- `impl Not for Wrapping<u32>`
- `impl<'a> Not for &'a Wrapping<u32>`
- `impl Not for Wrapping<u64>`
- `impl<'a> Not for &'a Wrapping<u64>`
- `impl Not for Wrapping<isize>`
- `impl<'a> Not for &'a Wrapping<isize>`
- `impl Not for Wrapping<i8>`
- `impl<'a> Not for &'a Wrapping<i8>`
- `impl Not for Wrapping<i16>`
- `impl<'a> Not for &'a Wrapping<i16>`
- `impl Not for Wrapping<i32>`
- `impl<'a> Not for &'a Wrapping<i32>`
- `impl Not for Wrapping<i64>`
- `impl<'a> Not for &'a Wrapping<i64>`
- `impl Not for bool`
- `impl<'a> Not for &'a bool`
- `impl Not for usize`
- `impl<'a> Not for &'a usize`
- `impl Not for u8`
- `impl<'a> Not for &'a u8`
- `impl Not for u16`
- `impl<'a> Not for &'a u16`
- `impl Not for u32`
- `impl<'a> Not for &'a u32`
- `impl Not for u64`
- `impl<'a> Not for &'a u64`
- `impl Not for isize`
- `impl<'a> Not for &'a isize`
- `impl Not for i8`
- `impl<'a> Not for &'a i8`
- `impl Not for i16`
- `impl<'a> Not for &'a i16`
- `impl Not for i32`
- `impl<'a> Not for &'a i32`
- `impl Not for i64`
- `impl<'a> Not for &'a i64`

# Help

## Keyboard Shortcuts

?
  Show this help dialog
S
  Focus the search field
⇤
  Move up in search results
⇥
  Move down in search results
⏎
  Go to active search result
+
  Collapse/expand all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)