pub fn exit_with_unrecoverable_error<T, E: Display>(err: E) -> T
Expand description

Exits the program. Useful when a type produces an error which can no longer be propagated, and the program must exit instead.

§Example of use

  • Without this function:
let res = ForeignClient::new(chains.src.clone(), chains.dst.clone());
let client = match res {
    Ok(client) => client,
    Err(e) => Output::error(format!("{}", e)).exit(),
};
  • With support from exit_with_unrecoverable_error:
let client_a = ForeignClient::new(chains.src.clone(), chains.dst.clone())
    .unwrap_or_else(exit_with_unrecoverable_error);