Trait caffe2_imports::Neg

1.0.0 · source ·
pub trait Neg {
    type Output;

    // Required method
    fn neg(self) -> Self::Output;
}
Expand description

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 = Self;

    fn neg(self) -> Self::Output {
        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);

Required Associated Types§

source

type Output

The resulting type after applying the - operator.

Required Methods§

source

fn neg(self) -> Self::Output

Performs the unary - operation.

Example
let x: i32 = 12;
assert_eq!(-x, -12);

Implementors§

const: unstable · source§

impl Neg for &f32

§

type Output = <f32 as Neg>::Output

const: unstable · source§

impl Neg for &f64

§

type Output = <f64 as Neg>::Output

const: unstable · source§

impl Neg for &i8

§

type Output = <i8 as Neg>::Output

const: unstable · source§

impl Neg for &i16

§

type Output = <i16 as Neg>::Output

const: unstable · source§

impl Neg for &i32

§

type Output = <i32 as Neg>::Output

const: unstable · source§

impl Neg for &i64

§

type Output = <i64 as Neg>::Output

const: unstable · source§

impl Neg for &i128

§

type Output = <i128 as Neg>::Output

const: unstable · source§

impl Neg for &isize

§

type Output = <isize as Neg>::Output

source§

impl Neg for &Saturating<i8>

source§

impl Neg for &Saturating<i16>

source§

impl Neg for &Saturating<i32>

source§

impl Neg for &Saturating<i64>

source§

impl Neg for &Saturating<i128>

source§

impl Neg for &Saturating<isize>

1.14.0 (const: unstable) · source§

impl Neg for &Wrapping<i8>

§

type Output = <Wrapping<i8> as Neg>::Output

1.14.0 (const: unstable) · source§

impl Neg for &Wrapping<i16>

1.14.0 (const: unstable) · source§

impl Neg for &Wrapping<i32>

1.14.0 (const: unstable) · source§

impl Neg for &Wrapping<i64>

1.14.0 (const: unstable) · source§

impl Neg for &Wrapping<i128>

1.14.0 (const: unstable) · source§

impl Neg for &Wrapping<isize>

1.14.0 (const: unstable) · source§

impl Neg for &Wrapping<u8>

§

type Output = <Wrapping<u8> as Neg>::Output

1.14.0 (const: unstable) · source§

impl Neg for &Wrapping<u16>

1.14.0 (const: unstable) · source§

impl Neg for &Wrapping<u32>

1.14.0 (const: unstable) · source§

impl Neg for &Wrapping<u64>

1.14.0 (const: unstable) · source§

impl Neg for &Wrapping<u128>

1.14.0 (const: unstable) · source§

impl Neg for &Wrapping<usize>

source§

impl Neg for &bf16

§

type Output = <bf16 as Neg>::Output

source§

impl Neg for &f16

§

type Output = <f16 as Neg>::Output

§

impl Neg for &f32x4

§

type Output = f32x4

§

impl Neg for &f32x8

§

type Output = f32x8

§

impl Neg for &f64x2

§

type Output = f64x2

§

impl Neg for &f64x4

§

type Output = f64x4

§

impl Neg for &i8x16

§

type Output = i8x16

§

impl Neg for &i8x32

§

type Output = i8x32

§

impl Neg for &i16x8

§

type Output = i16x8

§

impl Neg for &i16x16

§

type Output = i16x16

§

impl Neg for &i32x4

§

type Output = i32x4

§

impl Neg for &i32x8

§

type Output = i32x8

§

impl Neg for &i64x2

§

type Output = i64x2

§

impl Neg for &i64x4

§

type Output = i64x4

§

impl Neg for &u8x16

§

type Output = u8x16

§

impl Neg for &u16x8

§

type Output = u16x8

§

impl Neg for &u32x4

§

type Output = u32x4

§

impl Neg for &u32x8

§

type Output = u32x8

§

impl Neg for &u64x2

§

type Output = u64x2

§

impl Neg for &u64x4

§

type Output = u64x4

source§

impl Neg for Sign

§

type Output = Sign

const: unstable · source§

impl Neg for f32

§

type Output = f32

const: unstable · source§

impl Neg for f64

§

type Output = f64

const: unstable · source§

impl Neg for i8

§

type Output = i8

const: unstable · source§

impl Neg for i16

§

type Output = i16

const: unstable · source§

impl Neg for i32

§

type Output = i32

const: unstable · source§

impl Neg for i64

§

type Output = i64

const: unstable · source§

impl Neg for i128

§

type Output = i128

const: unstable · source§

impl Neg for isize

source§

impl Neg for Saturating<i8>

source§

impl Neg for Saturating<i16>

source§

impl Neg for Saturating<i32>

source§

impl Neg for Saturating<i64>

source§

impl Neg for Saturating<i128>

source§

impl Neg for Saturating<isize>

1.10.0 (const: unstable) · source§

impl Neg for Wrapping<i8>

1.10.0 (const: unstable) · source§

impl Neg for Wrapping<i16>

1.10.0 (const: unstable) · source§

impl Neg for Wrapping<i32>

1.10.0 (const: unstable) · source§

impl Neg for Wrapping<i64>

1.10.0 (const: unstable) · source§

impl Neg for Wrapping<i128>

1.10.0 (const: unstable) · source§

impl Neg for Wrapping<isize>

1.10.0 (const: unstable) · source§

impl Neg for Wrapping<u8>

1.10.0 (const: unstable) · source§

impl Neg for Wrapping<u16>

1.10.0 (const: unstable) · source§

impl Neg for Wrapping<u32>

1.10.0 (const: unstable) · source§

impl Neg for Wrapping<u64>

1.10.0 (const: unstable) · source§

impl Neg for Wrapping<u128>

1.10.0 (const: unstable) · source§

impl Neg for Wrapping<usize>

source§

impl Neg for BigInt

source§

impl Neg for ATerm

source§

impl Neg for Z0

-Z0 = Z0

§

type Output = Z0

source§

impl Neg for bf16

§

type Output = bf16

source§

impl Neg for f16

§

type Output = f16

§

impl Neg for AutoSimd<[f32; 2]>

§

type Output = AutoSimd<[f32; 2]>

§

impl Neg for AutoSimd<[f32; 4]>

§

type Output = AutoSimd<[f32; 4]>

§

impl Neg for AutoSimd<[f32; 8]>

§

type Output = AutoSimd<[f32; 8]>

§

impl Neg for AutoSimd<[f32; 16]>

§

type Output = AutoSimd<[f32; 16]>

§

impl Neg for AutoSimd<[f64; 2]>

§

type Output = AutoSimd<[f64; 2]>

§

impl Neg for AutoSimd<[f64; 4]>

§

type Output = AutoSimd<[f64; 4]>

§

impl Neg for AutoSimd<[f64; 8]>

§

type Output = AutoSimd<[f64; 8]>

§

impl Neg for AutoSimd<[i8; 2]>

§

type Output = AutoSimd<[i8; 2]>

§

impl Neg for AutoSimd<[i8; 4]>

§

type Output = AutoSimd<[i8; 4]>

§

impl Neg for AutoSimd<[i8; 8]>

§

type Output = AutoSimd<[i8; 8]>

§

impl Neg for AutoSimd<[i8; 16]>

§

type Output = AutoSimd<[i8; 16]>

§

impl Neg for AutoSimd<[i8; 32]>

§

type Output = AutoSimd<[i8; 32]>

§

impl Neg for AutoSimd<[i16; 2]>

§

type Output = AutoSimd<[i16; 2]>

§

impl Neg for AutoSimd<[i16; 4]>

§

type Output = AutoSimd<[i16; 4]>

§

impl Neg for AutoSimd<[i16; 8]>

§

type Output = AutoSimd<[i16; 8]>

§

impl Neg for AutoSimd<[i16; 16]>

§

type Output = AutoSimd<[i16; 16]>

§

impl Neg for AutoSimd<[i16; 32]>

§

type Output = AutoSimd<[i16; 32]>

§

impl Neg for AutoSimd<[i32; 2]>

§

type Output = AutoSimd<[i32; 2]>

§

impl Neg for AutoSimd<[i32; 4]>

§

type Output = AutoSimd<[i32; 4]>

§

impl Neg for AutoSimd<[i32; 8]>

§

type Output = AutoSimd<[i32; 8]>

§

impl Neg for AutoSimd<[i32; 16]>

§

type Output = AutoSimd<[i32; 16]>

§

impl Neg for AutoSimd<[i64; 2]>

§

type Output = AutoSimd<[i64; 2]>

§

impl Neg for AutoSimd<[i64; 4]>

§

type Output = AutoSimd<[i64; 4]>

§

impl Neg for AutoSimd<[i64; 8]>

§

type Output = AutoSimd<[i64; 8]>

§

impl Neg for AutoSimd<[i128; 1]>

§

type Output = AutoSimd<[i128; 1]>

§

impl Neg for AutoSimd<[i128; 2]>

§

type Output = AutoSimd<[i128; 2]>

§

impl Neg for AutoSimd<[i128; 4]>

§

type Output = AutoSimd<[i128; 4]>

§

impl Neg for AutoSimd<[isize; 2]>

§

type Output = AutoSimd<[isize; 2]>

§

impl Neg for AutoSimd<[isize; 4]>

§

type Output = AutoSimd<[isize; 4]>

§

impl Neg for AutoSimd<[isize; 8]>

§

type Output = AutoSimd<[isize; 8]>

§

impl Neg for WideF32x4

§

type Output = WideF32x4

§

impl Neg for f32x4

§

type Output = f32x4

§

impl Neg for f32x8

§

type Output = f32x8

§

impl Neg for f64x2

§

type Output = f64x2

§

impl Neg for f64x4

§

type Output = f64x4

§

impl Neg for i8x16

§

type Output = i8x16

§

impl Neg for i8x32

§

type Output = i8x32

§

impl Neg for i16x8

§

type Output = i16x8

§

impl Neg for i16x16

§

type Output = i16x16

§

impl Neg for i32x4

§

type Output = i32x4

§

impl Neg for i32x8

§

type Output = i32x8

§

impl Neg for i64x2

§

type Output = i64x2

§

impl Neg for i64x4

§

type Output = i64x4

§

impl Neg for m128

§

type Output = m128

§

impl Neg for m128d

§

type Output = m128d

§

impl Neg for u8x16

§

type Output = u8x16

§

impl Neg for u16x8

§

type Output = u16x8

§

impl Neg for u32x4

§

type Output = u32x4

§

impl Neg for u32x8

§

type Output = u32x8

§

impl Neg for u64x2

§

type Output = u64x2

§

impl Neg for u64x4

§

type Output = u64x4

source§

impl<'a> Neg for &'a BigInt

source§

impl<'a, A, S, D> Neg for &'a ArrayBase<S, D>where &'a A: 'a + Neg<Output = A>, S: Data<Elem = A>, D: Dimension,

source§

impl<'a, T> Neg for &'a Unit<DualQuaternion<T>>where T: SimdRealField, <T as SimdValue>::Element: SimdRealField,

source§

impl<'a, T> Neg for &'a DualQuaternion<T>where T: SimdRealField, <T as SimdValue>::Element: SimdRealField,

source§

impl<'a, T> Neg for &'a Quaternion<T>where T: SimdRealField, <T as SimdValue>::Element: SimdRealField,

source§

impl<'a, T> Neg for &'a Ratio<T>where T: Clone + Integer + Neg<Output = T>,

§

type Output = Ratio<T>

source§

impl<'a, T> Neg for &'a Complex<T>where T: Clone + Num + Neg<Output = T>,

§

type Output = Complex<T>

source§

impl<'a, T, D> Neg for &'a OPoint<T, D>where T: Scalar + ClosedNeg, D: DimName, DefaultAllocator: Allocator<T, D, Const<1>>,

§

type Output = OPoint<T, D>

source§

impl<'a, T, R, C, S> Neg for &'a Matrix<T, R, C, S>where R: Dim, C: Dim, T: Scalar + ClosedNeg, S: Storage<T, R, C>, DefaultAllocator: Allocator<T, R, C>,

§

type Output = Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer>

source§

impl<'py> Neg for &'py PyComplex

§

type Output = &'py PyComplex

source§

impl<A, S, D> Neg for ArrayBase<S, D>where A: Clone + Neg<Output = A>, S: DataOwned<Elem = A> + DataMut, D: Dimension,

§

type Output = ArrayBase<S, D>

source§

impl<T> Neg for Unit<DualQuaternion<T>>where T: SimdRealField, <T as SimdValue>::Element: SimdRealField,

source§

impl<T> Neg for DualQuaternion<T>where T: SimdRealField, <T as SimdValue>::Element: SimdRealField,

source§

impl<T> Neg for Quaternion<T>where T: SimdRealField, <T as SimdValue>::Element: SimdRealField,

source§

impl<T> Neg for Ratio<T>where T: Clone + Integer + Neg<Output = T>,

§

type Output = Ratio<T>

source§

impl<T> Neg for Complex<T>where T: Clone + Num + Neg<Output = T>,

§

type Output = Complex<T>

source§

impl<T, D> Neg for OPoint<T, D>where T: Scalar + ClosedNeg, D: DimName, DefaultAllocator: Allocator<T, D, Const<1>>,

§

type Output = OPoint<T, D>

source§

impl<T, R, C> Neg for Unit<Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer>>where T: Scalar + ClosedNeg, R: Dim, C: Dim, DefaultAllocator: Allocator<T, R, C>,

§

type Output = Unit<Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer>>

source§

impl<T, R, C, S> Neg for Matrix<T, R, C, S>where R: Dim, C: Dim, T: Scalar + ClosedNeg, S: Storage<T, R, C>, DefaultAllocator: Allocator<T, R, C>,

§

type Output = Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer>

source§

impl<T, const N: usize> Neg for VecN<T, N>where T: Neg<Output = T> + Copy,

§

type Output = VecN<T, N>

source§

impl<U> Neg for NInt<U>where U: Unsigned + NonZero,

-NInt = PInt

§

type Output = PInt<U>

source§

impl<U> Neg for PInt<U>where U: Unsigned + NonZero,

-PInt = NInt

§

type Output = NInt<U>

source§

impl<V, A> Neg for TArr<V, A>where V: Neg, A: Neg,

§

type Output = TArr<<V as Neg>::Output, <A as Neg>::Output>

source§

impl<const LANES: usize> Neg for Simd<f32, LANES>where f32: SimdElement, LaneCount<LANES>: SupportedLaneCount,

§

type Output = Simd<f32, LANES>

source§

impl<const LANES: usize> Neg for Simd<f64, LANES>where f64: SimdElement, LaneCount<LANES>: SupportedLaneCount,

§

type Output = Simd<f64, LANES>

source§

impl<const LANES: usize> Neg for Simd<i8, LANES>where i8: SimdElement, LaneCount<LANES>: SupportedLaneCount,

§

type Output = Simd<i8, LANES>

source§

impl<const LANES: usize> Neg for Simd<i16, LANES>where i16: SimdElement, LaneCount<LANES>: SupportedLaneCount,

§

type Output = Simd<i16, LANES>

source§

impl<const LANES: usize> Neg for Simd<i32, LANES>where i32: SimdElement, LaneCount<LANES>: SupportedLaneCount,

§

type Output = Simd<i32, LANES>

source§

impl<const LANES: usize> Neg for Simd<i64, LANES>where i64: SimdElement, LaneCount<LANES>: SupportedLaneCount,

§

type Output = Simd<i64, LANES>

source§

impl<const LANES: usize> Neg for Simd<isize, LANES>where isize: SimdElement, LaneCount<LANES>: SupportedLaneCount,

§

type Output = Simd<isize, LANES>