Hi,
I was wondering if there was a better (shorter or more idiomatic) way of extracting the value inside an Option or returning from the function if it has None. Here's what I usually do:
let result = match some_function_call(some_parameters) {
Some (x) => x,
None => return Err(String("Some error")),
};
It works perfectly fine, but it feels a bit verbose, and the 'Some(x)=>x' feels weird to me somehow.
(I can't use expect() because I don't want to panic on None)