Trait sp_std::ops::Not

1.0.0 · source ·
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);

Required 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);

Implementors§

impl<A, O> Not for BitArray<A, O>where
    A: BitViewSized,
    O: BitOrder,

impl<T, O> Not for BitBox<T, O>where
    T: BitStore,
    O: BitOrder,

impl<R> Not for BitMask<R>where
    R: BitRegister,

impl<M, T, O> Not for BitRef<'_, M, T, O>where
    M: Mutability,
    T: BitStore,
    O: BitOrder,

impl<'a, T, O> Not for &'a mut BitSlice<T, O>where
    T: BitStore,
    O: BitOrder,

impl<T, O> Not for BitVec<T, O>where
    T: BitStore,
    O: BitOrder,

impl Not for Limb

impl<const LIMBS: usize> Not for UInt<LIMBS>

impl<const LIMBS: usize> Not for Wrapping<UInt<LIMBS>>

impl<T> Not for BitFlags<T>where
    T: BitFlag,

impl<Frac> Not for FixedU8<Frac>

impl<Frac> Not for &FixedU8<Frac>

impl<Frac> Not for FixedU16<Frac>

impl<Frac> Not for &FixedU16<Frac>

impl<Frac> Not for FixedU32<Frac>

impl<Frac> Not for &FixedU32<Frac>

impl<Frac> Not for FixedU64<Frac>

impl<Frac> Not for &FixedU64<Frac>

impl<Frac> Not for FixedU128<Frac>

impl<Frac> Not for &FixedU128<Frac>

impl<Frac> Not for FixedI8<Frac>

impl<Frac> Not for &FixedI8<Frac>

impl<Frac> Not for FixedI16<Frac>

impl<Frac> Not for &FixedI16<Frac>

impl<Frac> Not for FixedI32<Frac>

impl<Frac> Not for &FixedI32<Frac>

impl<Frac> Not for FixedI64<Frac>

impl<Frac> Not for &FixedI64<Frac>

impl<Frac> Not for FixedI128<Frac>

impl<Frac> Not for &FixedI128<Frac>

impl<F> Not for Unwrapped<F>where
    F: Not<Output = F>,

impl<F> Not for &Unwrapped<F>where
    for<'a> &'a F: Not<Output = F>,

impl<F> Not for Wrapping<F>where
    F: Not<Output = F>,

impl<F> Not for &Wrapping<F>where
    for<'a> &'a F: Not<Output = F>,

impl Not for &BigInt

impl Not for BigInt

impl Not for &Boolean

impl Not for Boolean

impl Not for &Number

impl Not for Number

impl Not for Endpoint

impl Not for RouteFlags

impl Not for NextHopFlags

impl Not for RuleFlags

impl Not for AtFlags

impl Not for OFlag

impl Not for RenameFlags

impl Not for SealFlag

impl Not for FdFlag

impl Not for MsFlags

impl Not for MntFlags

impl Not for CloneFlags

impl Not for SaFlags

impl Not for SfdFlags

impl Not for SFlag

impl Not for Mode

impl Not for FsFlags

impl Not for WaitPidFlag

impl Not for AccessFlags

impl Not for BigInt

impl<'a> Not for &'a BigInt

impl Not for U128

impl Not for U256

impl Not for U512

impl Not for Protection

impl Not for FdFlags

impl Not for Access

impl Not for AtFlags

impl Not for Mode

impl Not for OFlags

impl Not for ResolveFlags

impl Not for RenameFlags

impl Not for MemfdFlags

impl Not for SealFlags

impl Not for StatxFlags

impl Not for PollFlags

impl Not for DupFlags

impl Not for PipeFlags

impl Not for EventfdFlags

impl Not for CreateFlags

impl Not for EventFlags

impl Not for ProtFlags

impl Not for MapFlags

impl Not for MremapFlags

impl Not for MsyncFlags

impl Not for MlockFlags

impl Not for AutoSimd<[bool; 1]>

impl Not for AutoSimd<[bool; 2]>

impl Not for AutoSimd<[bool; 4]>

impl Not for AutoSimd<[bool; 8]>

impl Not for AutoSimd<[bool; 16]>

impl Not for AutoSimd<[bool; 32]>

impl Not for Capabilities

impl Not for Choice

impl Not for B0

impl Not for B1

impl Not for &JsValue

impl Not for JsValue