#Any short hand for this
5 messages · Page 1 of 1 (latest)
I'm expecting something like...
let first_number = some_func().if_err_return(some_response_err());
let first_number = first_number_str.parse::<i32>()?;```
actually in the parent function I am not using Result. Rather HttpResponse. I'm sorry the given example was bad. This example has a bit more details
async fn some_func() -> HttpResponse {
let payload: CustomRequest = match qs_config.deserialize_bytes(&some_var) {
Ok(p) => p,
Err(_) => {
return http_response_err(
"some response"
)
}
};
some_other_func() // returns a HttpResponse
}
There is something for this, which we might have just stabilized, I'm not sure (that, or it's coming in 6ish weeks, next stable)
let Ok(payload) = qs_config.deserialize_bytes(&some_var) else { return http_response_err("some response") };