Function branch

Source
pub fn branch<A: Clone + 'static + FromStr, B, TH, EL>(
    vm: &mut RoundVM,
    cond: B,
    thn: TH,
    els: EL,
) -> A
where B: Fn() -> bool, TH: Fn(&mut RoundVM) -> A + Copy, EL: Fn(&mut RoundVM) -> A + Copy,
Expand description

Partitions the domain into two subspaces that do not interact with each other.

§Arguments

  • vm the current VM
  • cond the condition to evaluate
  • thn the expression to evaluate if the condition is true
  • els the expression to evaluate if the condition is false

§Generic Parameters

  • A The type of value returned by the expression.
  • B - The type of cond, which must be a closure that takes no arguments and returns a value of type bool.
  • F - The type of thn and els, which must be a closure that takes a RoundVM as argument and returns a tuple (RoundVM, A).

§Returns

the value of the expression