Then for functions that return Result<T, tonic::Status>, explicit conversion into status is not needed:
something_that_returns_lc_error_result().map_err(|e| e.into_status())?;
/* is equivalent to a more succinct form of */
something_that_returns_lc_error_result()?;
Full description:
Explicit conversion of LcError into Result<T, Status>::Err for return by the question mark operator can be elided by implementing From<LcError> for Status, thanks to the question mark operator being able to accept not just Err<Status> but Err<impl Into<Status>>, which is automatically provided by the implementation of From<LcError> for Status.
tl;dr ―
Then for functions that return
Result<T, tonic::Status>
, explicit conversion into status is not needed:Full description:
Explicit conversion of
LcError
intoResult<T, Status>::Err
for return by the question mark operator can be elided by implementingFrom<LcError> for Status
, thanks to the question mark operator being able to accept not justErr<Status>
butErr<impl Into<Status>>
, which is automatically provided by the implementation ofFrom<LcError> for Status
.Same deal for
AttTrError
.