pub trait Ternary {
    type Boolean;
    type Output;

    // Required method
    fn ternary(
        condition: &Self::Boolean,
        first: &Self,
        second: &Self
    ) -> Self::Output
       where Self: Sized;
}
Expand description

Trait for ternary operations.

Required Associated Types§

type Boolean

type Output

Required Methods§

fn ternary( condition: &Self::Boolean, first: &Self, second: &Self ) -> Self::Outputwhere Self: Sized,

Returns first if condition is true, otherwise returns second.

Trait Implementations§

source§

impl<E> Metrics<dyn Ternary<Output = Address<E>, Boolean = Boolean<E>>> for Address<E>where E: Environment,

§

type Case = (Mode, Mode, Mode)

source§

fn count( case: &<Address<E> as Metrics<dyn Ternary<Output = Address<E>, Boolean = Boolean<E>>>>::Case ) -> Count

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

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

§

type Case = (Mode, Mode, Mode)

source§

fn count( case: &<Field<E> as Metrics<dyn Ternary<Output = Field<E>, Boolean = Boolean<E>>>>::Case ) -> Count

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

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

§

type Case = (Mode, Mode, Mode)

source§

fn count( case: &<Group<E> as Metrics<dyn Ternary<Output = Group<E>, Boolean = Boolean<E>>>>::Case ) -> Count

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

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

§

type Case = (Mode, Mode, Mode)

source§

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

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

impl<E> OutputMode<dyn Ternary<Output = Address<E>, Boolean = Boolean<E>>> for Address<E>where E: Environment,

§

type Case = (CircuitType<Boolean<E>>, Mode, Mode)

source§

fn output_mode( parameter: &<Address<E> as OutputMode<dyn Ternary<Output = Address<E>, Boolean = Boolean<E>>>>::Case ) -> Mode

Returns the mode of the output.
source§

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

§

type Case = (CircuitType<Boolean<E>>, Mode, Mode)

source§

fn output_mode( parameter: &<Field<E> as OutputMode<dyn Ternary<Output = Field<E>, Boolean = Boolean<E>>>>::Case ) -> Mode

Returns the mode of the output.
source§

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

§

type Case = (CircuitType<Boolean<E>>, Mode, Mode)

source§

fn output_mode( parameter: &<Group<E> as OutputMode<dyn Ternary<Output = Group<E>, Boolean = Boolean<E>>>>::Case ) -> Mode

Returns the mode of the output.
source§

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

§

type Case = (CircuitType<Boolean<E>>, Mode, Mode)

source§

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

Returns the mode of the output.

Implementations on Foreign Types§

§

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

§

fn ternary( condition: &<Field<E> as Ternary>::Boolean, first: &Field<E>, second: &Field<E> ) -> <Field<E> as Ternary>::Output

Returns first if condition is true, otherwise returns second.

§

type Boolean = Boolean<E>

§

type Output = Field<E>

§

impl<E> Ternary for Boolean<E>where E: Environment,

§

fn ternary( condition: &<Boolean<E> as Ternary>::Boolean, first: &Boolean<E>, second: &Boolean<E> ) -> <Boolean<E> as Ternary>::Output

Returns first if condition is true, otherwise returns second.

§

type Boolean = Boolean<E>

§

type Output = Boolean<E>

§

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

§

fn ternary( condition: &<Group<E> as Ternary>::Boolean, first: &Group<E>, second: &Group<E> ) -> <Group<E> as Ternary>::Output

Returns first if condition is true, otherwise returns second.

§

type Boolean = Boolean<E>

§

type Output = Group<E>

§

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

§

fn ternary( condition: &<Scalar<E> as Ternary>::Boolean, first: &Scalar<E>, second: &Scalar<E> ) -> <Scalar<E> as Ternary>::Output

Returns first if condition is true, otherwise returns second.

§

type Boolean = Boolean<E>

§

type Output = Scalar<E>

§

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

§

fn ternary( condition: &<Integer<E, I> as Ternary>::Boolean, first: &Integer<E, I>, second: &Integer<E, I> ) -> <Integer<E, I> as Ternary>::Output

Returns first if condition is true, otherwise returns second.

§

type Boolean = Boolean<E>

§

type Output = Integer<E, I>

§

impl<E> Ternary for Address<E>where E: Environment,

§

fn ternary( condition: &<Address<E> as Ternary>::Boolean, first: &Address<E>, second: &Address<E> ) -> <Address<E> as Ternary>::Output

Returns first if condition is true, otherwise returns second.

§

type Boolean = Boolean<E>

§

type Output = Address<E>

source§

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

source§

fn ternary( condition: &<Integer<E, I> as Ternary>::Boolean, first: &Integer<E, I>, second: &Integer<E, I> ) -> <Integer<E, I> as Ternary>::Output

Returns first if condition is true, otherwise returns second.

§

type Boolean = Boolean<E>

§

type Output = Integer<E, I>

§

impl<E> Ternary for StringType<E>where E: Environment,

§

fn ternary( condition: &<StringType<E> as Ternary>::Boolean, first: &StringType<E>, second: &StringType<E> ) -> <StringType<E> as Ternary>::Output

Returns first if condition is true, otherwise returns second.

§

type Boolean = Boolean<E>

§

type Output = StringType<E>

Implementors§

source§

impl<E> Ternary for snarkvm_circuit_types::Address<E>where E: Environment,

§

type Boolean = Boolean<E>

§

type Output = Address<E>

source§

impl<E> Ternary for snarkvm_circuit_types::Boolean<E>where E: Environment,

§

type Boolean = Boolean<E>

§

type Output = Boolean<E>

source§

impl<E> Ternary for snarkvm_circuit_types::Field<E>where E: Environment,

§

type Boolean = Boolean<E>

§

type Output = Field<E>

source§

impl<E> Ternary for snarkvm_circuit_types::Group<E>where E: Environment,

§

type Boolean = Boolean<E>

§

type Output = Group<E>

source§

impl<E> Ternary for snarkvm_circuit_types::Scalar<E>where E: Environment,

§

type Boolean = Boolean<E>

§

type Output = Scalar<E>