> the ideal implementation should include some short syntax to allow converting from Result to result value and throw panic for errors
As far as I know rust implements that with the '?' syntax.
As far as I know rust implements that with the '?' syntax.
match foo {
Ok(v) => v,
Err(e) => return From::from(e)
}
What "converts a Result into a value and panics on error" is Result::unwrap[0], or Result::expect[1] (for a custom panic message).[-1] as of rustc 1.46 anyway, I don't know how "try blocks" will effect `?`, though possibly the combination of "try blocks" and unwrap would make it easier to just panic an entire function: currently each Result site has to be unwrapped by hand whereas otherwise you could just `?` every site normally and unwrap the entire block I guess?
[0] https://doc.rust-lang.org/std/result/enum.Result.html#method...
[1] https://doc.rust-lang.org/std/result/enum.Result.html#method...