fn add_unsafe(a: i32, b: i32) -> i32 {
  a + b
}

fn add_safer(a: i32, b: i32) -> std::io::Result<i32> {
  Ok(add_unsafe(a, b))
}

fn add_option(a: i32, b:i32) -> Option<std::io::Result<i32>> {
  Some(add_safer(a, b))
}

fn main() {
  println!("{:?}", add_option("4".parse::<i32>().unwrap(), "5".parse::<i32>().unwrap()).unwrap().unwrap());
}

it unwraps

By onrirr mqhirr, 2023-08-10 11:21:24