Trait cairo_vm::with_std::ops::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§

1.0.0 · source

type Output

The resulting type after applying the - operator.

Required Methods§

1.0.0 · source

fn neg(self) -> Self::Output

Performs the unary - operation.

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

Implementors§

1.0.0 · source§

impl Neg for &f16

§

type Output = <f16 as Neg>::Output

1.0.0 · source§

impl Neg for &f32

§

type Output = <f32 as Neg>::Output

1.0.0 · source§

impl Neg for &f64

§

type Output = <f64 as Neg>::Output

1.0.0 · source§

impl Neg for &f128

§

type Output = <f128 as Neg>::Output

1.0.0 · source§

impl Neg for &i8

§

type Output = <i8 as Neg>::Output

1.0.0 · source§

impl Neg for &i16

§

type Output = <i16 as Neg>::Output

1.0.0 · source§

impl Neg for &i32

§

type Output = <i32 as Neg>::Output

1.0.0 · source§

impl Neg for &i64

§

type Output = <i64 as Neg>::Output

1.0.0 · source§

impl Neg for &i128

§

type Output = <i128 as Neg>::Output

1.0.0 · source§

impl Neg for &isize

§

type Output = <isize as Neg>::Output

source§

impl Neg for &Felt

§

type Output = Felt

1.71.0 · source§

impl Neg for &NonZero<i8>

§

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

1.71.0 · source§

impl Neg for &NonZero<i16>

§

type Output = <NonZero<i16> as Neg>::Output

1.71.0 · source§

impl Neg for &NonZero<i32>

§

type Output = <NonZero<i32> as Neg>::Output

1.71.0 · source§

impl Neg for &NonZero<i64>

§

type Output = <NonZero<i64> as Neg>::Output

1.71.0 · source§

impl Neg for &NonZero<i128>

1.71.0 · source§

impl Neg for &NonZero<isize>

1.74.0 · source§

impl Neg for &Saturating<i8>

1.74.0 · source§

impl Neg for &Saturating<i16>

1.74.0 · source§

impl Neg for &Saturating<i32>

1.74.0 · source§

impl Neg for &Saturating<i64>

1.74.0 · source§

impl Neg for &Saturating<i128>

1.74.0 · source§

impl Neg for &Saturating<isize>

1.14.0 · source§

impl Neg for &cairo_vm::with_std::num::Wrapping<i8>

§

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

1.14.0 · source§

impl Neg for &cairo_vm::with_std::num::Wrapping<i16>

1.14.0 · source§

impl Neg for &cairo_vm::with_std::num::Wrapping<i32>

1.14.0 · source§

impl Neg for &cairo_vm::with_std::num::Wrapping<i64>

1.14.0 · source§

impl Neg for &cairo_vm::with_std::num::Wrapping<i128>

1.14.0 · source§

impl Neg for &cairo_vm::with_std::num::Wrapping<isize>

1.14.0 · source§

impl Neg for &cairo_vm::with_std::num::Wrapping<u8>

§

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

1.14.0 · source§

impl Neg for &cairo_vm::with_std::num::Wrapping<u16>

1.14.0 · source§

impl Neg for &cairo_vm::with_std::num::Wrapping<u32>

1.14.0 · source§

impl Neg for &cairo_vm::with_std::num::Wrapping<u64>

1.14.0 · source§

impl Neg for &cairo_vm::with_std::num::Wrapping<u128>

1.14.0 · source§

impl Neg for &cairo_vm::with_std::num::Wrapping<usize>

source§

impl Neg for &BigInt

source§

impl Neg for &starknet_curve::ec_point::AffinePoint

source§

impl Neg for &starknet_types_core::curve::affine_point::AffinePoint

source§

impl Neg for &ProjectivePoint

source§

impl Neg for Sign

§

type Output = Sign

1.0.0 · source§

impl Neg for f16

§

type Output = f16

1.0.0 · source§

impl Neg for f32

§

type Output = f32

1.0.0 · source§

impl Neg for f64

§

type Output = f64

1.0.0 · source§

impl Neg for f128

§

type Output = f128

1.0.0 · source§

impl Neg for i8

§

type Output = i8

1.0.0 · source§

impl Neg for i16

§

type Output = i16

1.0.0 · source§

impl Neg for i32

§

type Output = i32

1.0.0 · source§

impl Neg for i64

§

type Output = i64

1.0.0 · source§

impl Neg for i128

§

type Output = i128

1.0.0 · source§

impl Neg for isize

source§

impl Neg for Felt

§

type Output = Felt

1.71.0 · source§

impl Neg for NonZero<i8>

1.71.0 · source§

impl Neg for NonZero<i16>

1.71.0 · source§

impl Neg for NonZero<i32>

1.71.0 · source§

impl Neg for NonZero<i64>

1.71.0 · source§

impl Neg for NonZero<i128>

1.71.0 · source§

impl Neg for NonZero<isize>

1.74.0 · source§

impl Neg for Saturating<i8>

1.74.0 · source§

impl Neg for Saturating<i16>

1.74.0 · source§

impl Neg for Saturating<i32>

1.74.0 · source§

impl Neg for Saturating<i64>

1.74.0 · source§

impl Neg for Saturating<i128>

1.74.0 · source§

impl Neg for Saturating<isize>

1.10.0 · source§

impl Neg for cairo_vm::with_std::num::Wrapping<i8>

1.10.0 · source§

impl Neg for cairo_vm::with_std::num::Wrapping<i16>

1.10.0 · source§

impl Neg for cairo_vm::with_std::num::Wrapping<i32>

1.10.0 · source§

impl Neg for cairo_vm::with_std::num::Wrapping<i64>

1.10.0 · source§

impl Neg for cairo_vm::with_std::num::Wrapping<i128>

1.10.0 · source§

impl Neg for cairo_vm::with_std::num::Wrapping<isize>

1.10.0 · source§

impl Neg for cairo_vm::with_std::num::Wrapping<u8>

1.10.0 · source§

impl Neg for cairo_vm::with_std::num::Wrapping<u16>

1.10.0 · source§

impl Neg for cairo_vm::with_std::num::Wrapping<u32>

1.10.0 · source§

impl Neg for cairo_vm::with_std::num::Wrapping<u64>

1.10.0 · source§

impl Neg for cairo_vm::with_std::num::Wrapping<u128>

1.10.0 · source§

impl Neg for cairo_vm::with_std::num::Wrapping<usize>

source§

impl Neg for crypto_bigint::wrapping::Wrapping<Limb>

source§

impl Neg for BigInt

source§

impl Neg for Decimal

source§

impl Neg for starknet_ff::FieldElement

source§

impl Neg for Duration

source§

impl Neg for UtcOffset

source§

impl Neg for ATerm

source§

impl Neg for Z0

-Z0 = Z0

§

type Output = Z0

source§

impl<'a> Neg for &'a Decimal

source§

impl<F> Neg for &lambdaworks_math::field::element::FieldElement<F>
where F: IsField,

Negation operator overloading for field elements*/

source§

impl<F> Neg for &Polynomial<FieldElement<F>>
where F: IsField,

source§

impl<F> Neg for lambdaworks_math::field::element::FieldElement<F>
where F: IsField,

source§

impl<F> Neg for Polynomial<FieldElement<F>>
where F: IsField,

source§

impl<MOD, const LIMBS: usize> Neg for &Residue<MOD, LIMBS>
where MOD: ResidueParams<LIMBS>,

§

type Output = Residue<MOD, LIMBS>

source§

impl<MOD, const LIMBS: usize> Neg for Residue<MOD, LIMBS>
where MOD: ResidueParams<LIMBS>,

§

type Output = Residue<MOD, LIMBS>

source§

impl<P> Neg for CubicExtField<P>
where P: CubicExtConfig,

source§

impl<P> Neg for QuadExtField<P>
where P: QuadExtConfig,

source§

impl<P, const N: usize> Neg for Fp<P, N>
where P: FpConfig<N>,

§

type Output = Fp<P, N>

source§

impl<T, R> Neg for &ReducedInt<T, R>
where T: PartialEq + Clone, R: Reducer<T> + Clone,

§

type Output = ReducedInt<T, R>

source§

impl<T, R> Neg for ReducedInt<T, R>
where T: PartialEq, R: Reducer<T>,

§

type Output = ReducedInt<T, R>

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 LIMBS: usize> Neg for &DynResidue<LIMBS>

§

type Output = DynResidue<LIMBS>

source§

impl<const LIMBS: usize> Neg for DynResidue<LIMBS>

§

type Output = DynResidue<LIMBS>

source§

impl<const LIMBS: usize> Neg for crypto_bigint::wrapping::Wrapping<Uint<LIMBS>>

§

type Output = Wrapping<Uint<LIMBS>>

source§

impl<const N: usize> Neg for Simd<f32, N>

§

type Output = Simd<f32, N>

source§

impl<const N: usize> Neg for Simd<f64, N>

§

type Output = Simd<f64, N>

source§

impl<const N: usize> Neg for Simd<i8, N>

§

type Output = Simd<i8, N>

source§

impl<const N: usize> Neg for Simd<i16, N>

§

type Output = Simd<i16, N>

source§

impl<const N: usize> Neg for Simd<i32, N>

§

type Output = Simd<i32, N>

source§

impl<const N: usize> Neg for Simd<i64, N>

§

type Output = Simd<i64, N>

source§

impl<const N: usize> Neg for Simd<isize, N>

§

type Output = Simd<isize, N>