Ternary

Trait Ternary 

Source
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§

Required Methods§

Source

fn ternary( condition: &Self::Boolean, first: &Self, second: &Self, ) -> Self::Output
where 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,

Source§

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> OutputMode<dyn Ternary<Output = Address<E>, Boolean = Boolean<E>>> for Address<E>
where E: Environment,

Source§

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.

Implementations on Foreign Types§

Source§

impl<A> Ternary for Box<Signature<A>>
where A: Aleo,

Source§

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

Returns first if condition is true, otherwise returns second.

Source§

type Boolean = Boolean<A>

Source§

type Output = Box<Signature<A>>

Source§

impl<A> Ternary for ComputeKey<A>
where A: Aleo,

Source§

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

Returns first if condition is true, otherwise returns second.

Source§

type Boolean = Boolean<A>

Source§

type Output = ComputeKey<A>

Source§

impl<A> Ternary for Signature<A>
where A: Aleo,

Source§

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

Returns first if condition is true, otherwise returns second.

Source§

type Boolean = Boolean<A>

Source§

type Output = Signature<A>

Source§

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

Source§

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.

Source§

type Boolean = Boolean<E>

Source§

type Output = Address<E>

Source§

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

Source§

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.

Source§

type Boolean = Boolean<E>

Source§

type Output = Boolean<E>

Source§

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

Source§

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.

Source§

type Boolean = Boolean<E>

Source§

type Output = Field<E>

Source§

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

Source§

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.

Source§

type Boolean = Boolean<E>

Source§

type Output = Group<E>

Source§

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

Source§

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.

Source§

type Boolean = Boolean<E>

Source§

type Output = Scalar<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.

Source§

type Boolean = Boolean<E>

Source§

type Output = Integer<E, I>

Source§

impl<E, const VARIANT: usize> Ternary for BooleanHash<E, VARIANT>
where E: Environment,

Source§

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

Returns first if condition is true, otherwise returns second.

Source§

type Boolean = Boolean<E>

Source§

type Output = BooleanHash<E, VARIANT>

Source§

impl<N> Ternary for Box<Signature<N>>
where N: Network,

Source§

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

Returns first if condition is true, otherwise returns second.

Source§

type Boolean = Boolean<N>

Source§

type Output = Box<Signature<N>>

Implementors§

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

impl<N> Ternary for snarkvm_debug::prelude::ComputeKey<N>
where N: Network,

Source§

impl<N> Ternary for snarkvm_debug::prelude::Signature<N>
where N: Network,