Skip to main content

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.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

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

Source§

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

Returns first if condition is true, otherwise returns second.

Source§

type Boolean = Boolean<N>

Source§

type Output = ComputeKey<N>

Source§

impl<T> Ternary for Box<T>
where T: Ternary,

Source§

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

Returns first if condition is true, otherwise returns second.

Source§

type Boolean = <T as Ternary>::Boolean

Source§

type Output = Box<<T as Ternary>::Output>

Implementors§