Skip to main content

ApiResultExt

Trait ApiResultExt 

Source
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§

Source

fn into_ec(self) -> Result<Self::Ok>

Provided Methods§

Source

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.

Source

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.

Implementors§

Source§

impl<T> ApiResultExt for Result<T>

Source§

type Ok = T