Attribute Macro erg_proc_macros::exec_new_thread

source ·
#[exec_new_thread]
Expand description
#[exec_new_thread]
fn foo() -> Result<isize, Box<dyn std::error::Error>> {
    ...
}

↓ ↓

fn foo() -> Result<isize, Box<dyn std::error::Error>> {
  fn error(msg: impl Into<String>) -> std::io::Error {
    std::io::Error::new(std::io::ErrorKind::Other, msg.into())
  }
  fn f() -> Result<(), Box<dyn std::error::Error + Send>> {
    {...}.map_err(|e| Box::new(error(e.to_string())) as _)
  }
  exec_new_thread(f, "foo").map_err(|e| e as _)
}