Macro gstuff::try_fu

source ·
macro_rules! try_fu {
    ($e: expr) => { ... };
}
Expand description

Lifts an error into a boxed future. Box<Future<Item=_, Error=_>>.

For example:

Box::new (PGA.execute (select) .and_then (move |pr| -> Box<Future<Item=Vec<PgResult>, Error=PgFutureErr> + Send> {
  let day = try_fu! (pr[0].row (0) .col_str (0));
  let json = try_fu! (pr[0].row (0) .col_json (1, "stats"));
  let mut stats: S = try_fu! (json::from_value (json));
  ...
  Box::new (PGA.execute (update))
}))