Function rf_core::lang::builtins::mux

source ·
pub fn mux<A, C, TH, EL>(vm: RoundVM, cond: C, th: TH, el: EL) -> (RoundVM, A)
where C: Fn(RoundVM) -> (RoundVM, bool), TH: Fn(RoundVM) -> (RoundVM, A), EL: Fn(RoundVM) -> (RoundVM, A),
Expand description

Evaluates the given expressions and returns the result based on the given condition. N.B both th and el will be evaluated, thus they will both affect the [Path], but only the result of one of them will be returned.

Arguments

  • vm - The current VM.
  • cond - The condition to evaluate, which should return a boolean.
  • th - The then-expression to evaluate.
  • el - The else-expression to evaluate.

Returns

The result of the evaluation of the then-expression if the condition is true, else the result of the evaluation of the else-expression alongside the RoundVM.