Trait nom::lib::std::ops::Not1.0.0[][src]

pub trait Not {
    type Output;
    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);

Associated Types

The resulting type after applying the ! operator.

Required methods

Performs the unary ! operation.

Examples
assert_eq!(!true, false);
assert_eq!(!false, true);
assert_eq!(!1u8, 254);
assert_eq!(!0u8, 255);

Implementations on Foreign Types

Implementors

impl Not for AtFlags

impl Not for OFlag

impl Not for RenameFlags

impl Not for SealFlag

impl Not for FdFlag

impl Not for SpliceFFlags

impl Not for MsFlags

impl Not for MntFlags

impl Not for MQ_OFlag

impl Not for FdFlag

impl Not for PollFlags

impl Not for CloneFlags

impl Not for EpollFlags

impl Not for EfdFlags

impl Not for ProtFlags

impl Not for MapFlags

impl Not for MRemapFlags

impl Not for MsFlags

impl Not for Persona

impl Not for Options

impl Not for SaFlags

impl Not for SfdFlags

impl Not for SockFlag

impl Not for MsgFlags

impl Not for SFlag

impl Not for Mode

impl Not for FsFlags

impl Not for InputFlags

impl Not for OutputFlags

impl Not for ControlFlags

impl Not for LocalFlags

impl Not for WaitPidFlag

impl Not for InitFlags

impl Not for TimerFlags

impl Not for AccessFlags