pub trait ApiResultExt: Sized {
type Ok;
// Required method
fn into_ec(self) -> Result<Self::Ok>;
// Provided methods
fn retryable(self) -> Result<Option<Self::Ok>, ErrorCode> { ... }
fn into_server_result(self) -> Result<Self::Ok> { ... }
}Expand description
Extension trait for Result<T,ErrorCode>.
Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn retryable(self) -> Result<Option<Self::Ok>, ErrorCode>
fn retryable(self) -> Result<Option<Self::Ok>, ErrorCode>
Turns retryable errors into None, and the Result into a std::result::Result,
making the output suitable for use with crate::misc::task::retry.
Sourcefn into_server_result(self) -> Result<Self::Ok>
fn into_server_result(self) -> Result<Self::Ok>
When passing along a result from another server to a client, this method is called to modify any ErrorCode. For details, see ErrorCode::into_server_error.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.