pub fn execute_process<P, V>(process: P) -> V
where
  P: Process<Value = V>,
  V: 'static // + ::std::fmt::Debug
{
  let mut runtime = Runtime::new();

  let mut return_value = Rc::new(Cell::new(None));
  let mut return_value_clone = return_value.clone();

  let main_continuation = move |r: &mut Runtime, v: ()| {
    process.call(r, move |r: &mut Runtime, v: V| {
      // println!("Return value has been computed: {:?}", v);
      return_value.set(Some(v));
    });
  };

  runtime.on_current_instant(Box::new(main_continuation));
  runtime.execute();

  return_value_clone.take().unwrap()
}
/// Execute the given process in a freshly created `Runtime`,
/// and return the result value.
Execute the given process in a freshly created `Runtime`,
and return the result value.
Execute the given process in a freshly created ` Runtime ` and return the result value .
pub fn execute_process<P, V>(process: P) -> V
where
  P: Process<Value = V>,
  V: 'static // + ::std::fmt::Debug
{
  let mut runtime = Runtime::new();
  let mut return_value = Rc::new(Cell::new(None));
  let mut return_value_clone = return_value.clone();
  let main_continuation = move |r: &mut Runtime, v: ()| {
    process.call(r, move |r: &mut Runtime, v: V| {
      // println!("Return value has been computed: {:?}", v);
      return_value.set(Some(v));
    });
  };
  runtime.on_current_instant(Box::new(main_continuation));
  runtime.execute();
  return_value_clone.take().unwrap()
}
pub fn execute_process < P , V > ( process : P ) -> V where P : Process < Value = V > , V : ' static // + ::std::fmt::Debug { let mut runtime = Runtime :: new ( ) ; let mut return_value = Rc :: new ( Cell :: new ( None ) ) ; let mut return_value_clone = return_value . clone ( ) ; let main_continuation = move | r : & mut Runtime , v : ( ) | { process . call ( r , move | r : & mut Runtime , v : V | { // println!("Return value has been computed: {:?}", v); return_value . set ( Some ( v ) ) ; } ) ; } ; runtime . on_current_instant ( Box :: new ( main_continuation ) ) ; runtime . execute ( ) ; return_value_clone . take ( ) . unwrap ( ) }
Execute the given process in a freshly created `Runtime`,
and return the result value.
Execute the given process in a freshly created ` Runtime ` and return the result value .
process
P