by yjh0502 · 8y ago · 0 comments
fn do_something() -> Box<Future<Item=(), Error=Error>> {
let val = match do_result() {
Ok(x) => x,
Err(e) => return Box::new(err(e.into())),
};
// do something with `val`
unimplemented!();
} let val = do_result().map_err(|e| Box::new(err(e.into())))?;