Trait nom::lib::std::ops::Neg 1.0.0[−][src]
The unary negation operator -
.
Examples
An implementation of Neg
for Sign
, which allows the use of -
to
negate its value.
use std::ops::Neg; #[derive(Debug, PartialEq)] enum Sign { Negative, Zero, Positive, } impl Neg for Sign { type Output = Sign; fn neg(self) -> Sign { match self { Sign::Negative => Sign::Positive, Sign::Zero => Sign::Zero, Sign::Positive => Sign::Negative, } } } // A negative positive is a negative. assert_eq!(-Sign::Positive, Sign::Negative); // A double negative is a positive. assert_eq!(-Sign::Negative, Sign::Positive); // Zero is its own negation. assert_eq!(-Sign::Zero, Sign::Zero);
Associated Types
type Output
The resulting type after applying the -
operator.
Required Methods
Implementations on Foreign Types
impl<'a> Neg for &'a Wrapping<u8>
[src]
impl<'a> Neg for &'a Wrapping<u8>
impl Neg for i8x16
[src]
impl Neg for i8x16
impl<'a> Neg for &'a Wrapping<usize>
[src]
impl<'a> Neg for &'a Wrapping<usize>
impl Neg for f64x2
[src]
impl Neg for f64x2
impl Neg for i8x64
[src]
impl Neg for i8x64
impl Neg for Wrapping<i64>
[src]
impl Neg for Wrapping<i64>
impl Neg for i16x32
[src]
impl Neg for i16x32
impl Neg for i8x2
[src]
impl Neg for i8x2
impl<'a> Neg for &'a i128
[src]
impl<'a> Neg for &'a i128
impl Neg for Wrapping<isize>
[src]
impl Neg for Wrapping<isize>
impl Neg for i8x8
[src]
impl Neg for i8x8
impl Neg for Wrapping<i128>
[src]
impl Neg for Wrapping<i128>
impl Neg for Wrapping<i8>
[src]
impl Neg for Wrapping<i8>
impl Neg for i32x8
[src]
impl Neg for i32x8
impl Neg for f32
[src]
impl Neg for f32
impl<'a> Neg for &'a Wrapping<i128>
[src]
impl<'a> Neg for &'a Wrapping<i128>
impl Neg for f64
[src]
impl Neg for f64
impl<'a> Neg for &'a Wrapping<i64>
[src]
impl<'a> Neg for &'a Wrapping<i64>
impl Neg for Wrapping<u32>
[src]
impl Neg for Wrapping<u32>
impl Neg for f64x8
[src]
impl Neg for f64x8
impl Neg for f64x4
[src]
impl Neg for f64x4
impl Neg for i16x8
[src]
impl Neg for i16x8
impl Neg for isize
[src]
impl Neg for isize
impl Neg for i16x16
[src]
impl Neg for i16x16
impl Neg for i64x4
[src]
impl Neg for i64x4
impl Neg for f32x2
[src]
impl Neg for f32x2
impl Neg for i16x4
[src]
impl Neg for i16x4
impl Neg for i32x2
[src]
impl Neg for i32x2
impl Neg for Wrapping<u16>
[src]
impl Neg for Wrapping<u16>
impl<'a> Neg for &'a isize
[src]
impl<'a> Neg for &'a isize
impl<'a> Neg for &'a Wrapping<i16>
[src]
impl<'a> Neg for &'a Wrapping<i16>
impl Neg for i16
[src]
impl Neg for i16
impl Neg for i8x32
[src]
impl Neg for i8x32
impl<'a> Neg for &'a Wrapping<i8>
[src]
impl<'a> Neg for &'a Wrapping<i8>
impl<'a> Neg for &'a i16
[src]
impl<'a> Neg for &'a i16
impl Neg for Wrapping<usize>
[src]
impl Neg for Wrapping<usize>
impl Neg for i16x2
[src]
impl Neg for i16x2
impl Neg for Wrapping<u128>
[src]
impl Neg for Wrapping<u128>
impl Neg for f32x4
[src]
impl Neg for f32x4
impl Neg for i64x8
[src]
impl Neg for i64x8
impl Neg for i32
[src]
impl Neg for i32
impl Neg for i64
[src]
impl Neg for i64
impl Neg for Wrapping<u64>
[src]
impl Neg for Wrapping<u64>
impl Neg for f32x8
[src]
impl Neg for f32x8
impl<'a> Neg for &'a i32
[src]
impl<'a> Neg for &'a i32
impl Neg for Wrapping<i32>
[src]
impl Neg for Wrapping<i32>
impl<'a> Neg for &'a Wrapping<u128>
[src]
impl<'a> Neg for &'a Wrapping<u128>
impl<'a> Neg for &'a Wrapping<u16>
[src]
impl<'a> Neg for &'a Wrapping<u16>
impl Neg for i64x2
[src]
impl Neg for i64x2
impl Neg for i32x4
[src]
impl Neg for i32x4
impl<'a> Neg for &'a Wrapping<i32>
[src]
impl<'a> Neg for &'a Wrapping<i32>
impl<'a> Neg for &'a i64
[src]
impl<'a> Neg for &'a i64
impl<'a> Neg for &'a f32
[src]
impl<'a> Neg for &'a f32
impl Neg for Wrapping<i16>
[src]
impl Neg for Wrapping<i16>
impl Neg for f32x16
[src]
impl Neg for f32x16
impl<'a> Neg for &'a Wrapping<isize>
[src]
impl<'a> Neg for &'a Wrapping<isize>
impl<'a> Neg for &'a Wrapping<u64>
[src]
impl<'a> Neg for &'a Wrapping<u64>
impl Neg for Wrapping<u8>
[src]
impl Neg for Wrapping<u8>
impl<'a> Neg for &'a i8
[src]
impl<'a> Neg for &'a i8
impl Neg for i8
[src]
impl Neg for i8
impl Neg for i8x4
[src]
impl Neg for i8x4
impl Neg for i32x16
[src]
impl Neg for i32x16
impl<'a> Neg for &'a Wrapping<u32>
[src]
impl<'a> Neg for &'a Wrapping<u32>
impl<'a> Neg for &'a f64
[src]
impl<'a> Neg for &'a f64
impl Neg for i128
[src]
impl Neg for i128