Trait snarkvm_circuit::environment::prelude::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);

Trait Implementations§

§

impl<E> Metrics<dyn Neg<Output = Field<E>>> for Field<E>where E: Environment,

§

type Case = Mode

§

fn count( _case: &<Field<E> as Metrics<dyn Neg<Output = Field<E>>>>::Case ) -> Count

Returns the number of constants, public inputs, private inputs, and constraints.
§

impl<E> Metrics<dyn Neg<Output = Group<E>>> for Group<E>where E: Environment,

§

type Case = Mode

§

fn count( _case: &<Group<E> as Metrics<dyn Neg<Output = Group<E>>>>::Case ) -> Count

Returns the number of constants, public inputs, private inputs, and constraints.
§

impl<E, I> Metrics<dyn Neg<Output = Integer<E, I>>> for Integer<E, I>where E: Environment, I: IntegerType,

§

type Case = Mode

§

fn count( case: &<Integer<E, I> as Metrics<dyn Neg<Output = Integer<E, I>>>>::Case ) -> Count

Returns the number of constants, public inputs, private inputs, and constraints.
§

impl<E> OutputMode<dyn Neg<Output = Field<E>>> for Field<E>where E: Environment,

§

type Case = Mode

§

fn output_mode( case: &<Field<E> as OutputMode<dyn Neg<Output = Field<E>>>>::Case ) -> Mode

Returns the mode of the output.
§

impl<E> OutputMode<dyn Neg<Output = Group<E>>> for Group<E>where E: Environment,

§

type Case = Mode

§

fn output_mode( case: &<Group<E> as OutputMode<dyn Neg<Output = Group<E>>>>::Case ) -> Mode

Returns the mode of the output.
§

impl<E, I> OutputMode<dyn Neg<Output = Integer<E, I>>> for Integer<E, I>where E: Environment, I: IntegerType,

§

type Case = Mode

§

fn output_mode( case: &<Integer<E, I> as OutputMode<dyn Neg<Output = Integer<E, I>>>>::Case ) -> Mode

Returns the mode of the output.

Implementors§

source§

impl Neg for &f32

§

type Output = <f32 as Neg>::Output

source§

impl Neg for &f64

§

type Output = <f64 as Neg>::Output

source§

impl Neg for &i8

§

type Output = <i8 as Neg>::Output

source§

impl Neg for &i16

§

type Output = <i16 as Neg>::Output

source§

impl Neg for &i32

§

type Output = <i32 as Neg>::Output

source§

impl Neg for &i64

§

type Output = <i64 as Neg>::Output

source§

impl Neg for &i128

§

type Output = <i128 as Neg>::Output

source§

impl Neg for &isize

§

type Output = <isize as Neg>::Output

1.71.0 · source§

impl Neg for &NonZeroI8

1.71.0 · source§

impl Neg for &NonZeroI16

1.71.0 · source§

impl Neg for &NonZeroI32

1.71.0 · source§

impl Neg for &NonZeroI64

1.71.0 · source§

impl Neg for &NonZeroI128

1.71.0 · source§

impl Neg for &NonZeroIsize

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 · source§

impl Neg for &Wrapping<i8>

§

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

1.14.0 · source§

impl Neg for &Wrapping<i16>

1.14.0 · source§

impl Neg for &Wrapping<i32>

1.14.0 · source§

impl Neg for &Wrapping<i64>

1.14.0 · source§

impl Neg for &Wrapping<i128>

1.14.0 · source§

impl Neg for &Wrapping<isize>

1.14.0 · source§

impl Neg for &Wrapping<u8>

§

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

1.14.0 · source§

impl Neg for &Wrapping<u16>

1.14.0 · source§

impl Neg for &Wrapping<u32>

1.14.0 · source§

impl Neg for &Wrapping<u64>

1.14.0 · source§

impl Neg for &Wrapping<u128>

1.14.0 · source§

impl Neg for &Wrapping<usize>

source§

impl Neg for Sign

§

type Output = Sign

source§

impl Neg for f32

§

type Output = f32

source§

impl Neg for f64

§

type Output = f64

source§

impl Neg for i8

§

type Output = i8

source§

impl Neg for i16

§

type Output = i16

source§

impl Neg for i32

§

type Output = i32

source§

impl Neg for i64

§

type Output = i64

source§

impl Neg for i128

§

type Output = i128

source§

impl Neg for isize

1.71.0 · source§

impl Neg for NonZeroI8

1.71.0 · source§

impl Neg for NonZeroI16

1.71.0 · source§

impl Neg for NonZeroI32

1.71.0 · source§

impl Neg for NonZeroI64

1.71.0 · source§

impl Neg for NonZeroI128

1.71.0 · source§

impl Neg for NonZeroIsize

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 · source§

impl Neg for Wrapping<i8>

1.10.0 · source§

impl Neg for Wrapping<i16>

1.10.0 · source§

impl Neg for Wrapping<i32>

1.10.0 · source§

impl Neg for Wrapping<i64>

1.10.0 · source§

impl Neg for Wrapping<i128>

1.10.0 · source§

impl Neg for Wrapping<isize>

1.10.0 · source§

impl Neg for Wrapping<u8>

1.10.0 · source§

impl Neg for Wrapping<u16>

1.10.0 · source§

impl Neg for Wrapping<u32>

1.10.0 · source§

impl Neg for Wrapping<u64>

1.10.0 · source§

impl Neg for Wrapping<u128>

1.10.0 · 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<'a> Neg for &'a BigInt

§

impl<E> Neg for &snarkvm_circuit::Field<E>where E: Environment,

§

type Output = Field<E>

§

impl<E> Neg for &snarkvm_circuit::Group<E>where E: Environment,

§

type Output = Group<E>

§

impl<E> Neg for snarkvm_circuit::Field<E>where E: Environment,

§

type Output = Field<E>

§

impl<E> Neg for snarkvm_circuit::Group<E>where E: Environment,

§

type Output = Group<E>

§

impl<E> Neg for Field<E>where E: Environment,

§

type Output = Field<E>

§

impl<E> Neg for Group<E>where E: Environment,

§

type Output = Group<E>

§

impl<E> Neg for Scalar<E>where E: Environment,

§

type Output = Scalar<E>

§

impl<E, I> Neg for &Integer<E, I>where E: Environment, I: IntegerType,

§

type Output = Integer<E, I>

§

impl<E, I> Neg for Integer<E, I>where E: Environment, I: IntegerType,

§

type Output = Integer<E, I>

§

impl<E, I> Neg for Integer<E, I>where E: Environment, I: IntegerType,

§

type Output = Integer<E, I>

source§

impl<F> Neg for &snarkvm_circuit::LinearCombination<F>where F: PrimeField,

source§

impl<F> Neg for snarkvm_circuit::LinearCombination<F>where F: PrimeField,

§

impl<F> Neg for ConstraintVariable<F>where F: Field,

§

type Output = ConstraintVariable<F>

§

impl<F> Neg for DensePolynomial<F>where F: Field,

§

type Output = DensePolynomial<F>

§

impl<F> Neg for LinearCombination<F>where F: Field,

§

type Output = LinearCombination<F>

§

impl<P> Neg for Affine<P>where P: ShortWeierstrassParameters,

§

type Output = Affine<P>

§

impl<P> Neg for Affine<P>where P: TwistedEdwardsParameters,

§

type Output = Affine<P>

§

impl<P> Neg for Fp2<P>where P: Fp2Parameters,

§

type Output = Fp2<P>

§

impl<P> Neg for Fp6<P>where P: Fp6Parameters,

§

type Output = Fp6<P>

§

impl<P> Neg for Fp12<P>where P: Fp12Parameters,

§

type Output = Fp12<P>

§

impl<P> Neg for Fp256<P>where P: Fp256Parameters,

§

type Output = Fp256<P>

§

impl<P> Neg for Fp384<P>where P: Fp384Parameters,

§

type Output = Fp384<P>

§

impl<P> Neg for Projective<P>where P: ShortWeierstrassParameters,

§

type Output = Projective<P>

§

impl<P> Neg for Projective<P>where P: TwistedEdwardsParameters,

§

type Output = Projective<P>

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>