Trait OptionExt

Source
pub trait OptionExt<T>: Sized {
    // Required method
    fn into_tonic_err(
        self,
        code: Code,
        msg: &str,
        details: ErrorDetails,
    ) -> Result<T, Status>;

    // Provided methods
    fn into_tonic_not_found(self, msg: &str) -> Result<T, Status> { ... }
    fn into_tonic_internal_err(self, msg: &str) -> Result<T, Status> { ... }
    fn require(self, field: &str) -> Result<T, Status> { ... }
}

Required Methods§

Source

fn into_tonic_err( self, code: Code, msg: &str, details: ErrorDetails, ) -> Result<T, Status>

Provided Methods§

Source

fn into_tonic_not_found(self, msg: &str) -> Result<T, Status>

Source

fn into_tonic_internal_err(self, msg: &str) -> Result<T, Status>

Source

fn require(self, field: &str) -> Result<T, Status>

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.

Implementations on Foreign Types§

Source§

impl<T> OptionExt<T> for Option<T>

Source§

fn into_tonic_err( self, code: Code, msg: &str, details: ErrorDetails, ) -> Result<T, Status>

Implementors§