[][src]Trait tide::prelude::Status

pub trait Status<T, E>: Sealed {
    pub fn status<S>(self, status: S) -> Result<T, Error>
    where
        S: TryInto<StatusCode>,
        <S as TryInto<StatusCode>>::Error: Debug
;
pub fn with_status<S, F>(self, f: F) -> Result<T, Error>
    where
        S: TryInto<StatusCode>,
        F: FnOnce() -> S,
        <S as TryInto<StatusCode>>::Error: Debug
; }

Provides the status method for Result and Option.

This trait is sealed and cannot be implemented outside of http-types.

Required methods

pub fn status<S>(self, status: S) -> Result<T, Error> where
    S: TryInto<StatusCode>,
    <S as TryInto<StatusCode>>::Error: Debug
[src]

Wrap the error value with an additional status code.

pub fn with_status<S, F>(self, f: F) -> Result<T, Error> where
    S: TryInto<StatusCode>,
    F: FnOnce() -> S,
    <S as TryInto<StatusCode>>::Error: Debug
[src]

Wrap the error value with an additional status code that is evaluated lazily only once an error does occur.

Loading content...

Implementations on Foreign Types

impl<T, E> Status<T, E> for Result<T, E> where
    E: Error + Send + Sync + 'static, 
[src]

pub fn status<S>(self, status: S) -> Result<T, Error> where
    S: TryInto<StatusCode>,
    <S as TryInto<StatusCode>>::Error: Debug
[src]

Wrap the error value with an additional status code.

Panics

Panics if Status is not a valid StatusCode.

pub fn with_status<S, F>(self, f: F) -> Result<T, Error> where
    S: TryInto<StatusCode>,
    F: FnOnce() -> S,
    <S as TryInto<StatusCode>>::Error: Debug
[src]

Wrap the error value with an additional status code that is evaluated lazily only once an error does occur.

Panics

Panics if Status is not a valid StatusCode.

impl<T> Status<T, Infallible> for Option<T>[src]

pub fn status<S>(self, status: S) -> Result<T, Error> where
    S: TryInto<StatusCode>,
    <S as TryInto<StatusCode>>::Error: Debug
[src]

Wrap the error value with an additional status code.

Panics

Panics if Status is not a valid StatusCode.

pub fn with_status<S, F>(self, f: F) -> Result<T, Error> where
    S: TryInto<StatusCode>,
    F: FnOnce() -> S,
    <S as TryInto<StatusCode>>::Error: Debug
[src]

Wrap the error value with an additional status code that is evaluated lazily only once an error does occur.

Panics

Panics if Status is not a valid StatusCode.

Loading content...

Implementors

Loading content...