pub trait TryFromConn: Send + Sync + Sized + 'static {
    type Error: Send + Sync + Sized + 'static;

    // Required method
    fn try_from_conn<'life0, 'async_trait>(
        conn: &'life0 mut Conn
    ) -> Pin<Box<dyn Future<Output = Result<Self, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Like FromConn, but with an Error.

If you want to use this directly, Error needs to be Handler.

If Error is not Handler, you can use Result<T, E> as TryFromConn where T: TryFromConn<Error = E>

If extraction is infallible, implement FromConn.

Required Associated Types§

source

type Error: Send + Sync + Sized + 'static

The Error type. Tf this is a Handler, you can extract Self directly in a ApiHandler signature, and Error will be called on Conn if try_from_conn fails.

Required Methods§

source

fn try_from_conn<'life0, 'async_trait>( conn: &'life0 mut Conn ) -> Pin<Box<dyn Future<Output = Result<Self, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Attempt to extract Self from &mut Conn, returning Error in case of failure

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<A, B> TryFromConn for (A, B)
where A: TryFromConn, <A as TryFromConn>::Error: Handler, B: TryFromConn, <B as TryFromConn>::Error: Handler,

§

type Error = Box<dyn Handler>

source§

fn try_from_conn<'life0, 'async_trait>( conn: &'life0 mut Conn ) -> Pin<Box<dyn Future<Output = Result<Self, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source§

impl<A, B, C> TryFromConn for (A, B, C)
where A: TryFromConn, <A as TryFromConn>::Error: Handler, B: TryFromConn, <B as TryFromConn>::Error: Handler, C: TryFromConn, <C as TryFromConn>::Error: Handler,

§

type Error = Box<dyn Handler>

source§

fn try_from_conn<'life0, 'async_trait>( conn: &'life0 mut Conn ) -> Pin<Box<dyn Future<Output = Result<Self, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source§

impl<A, B, C, D> TryFromConn for (A, B, C, D)
where A: TryFromConn, <A as TryFromConn>::Error: Handler, B: TryFromConn, <B as TryFromConn>::Error: Handler, C: TryFromConn, <C as TryFromConn>::Error: Handler, D: TryFromConn, <D as TryFromConn>::Error: Handler,

§

type Error = Box<dyn Handler>

source§

fn try_from_conn<'life0, 'async_trait>( conn: &'life0 mut Conn ) -> Pin<Box<dyn Future<Output = Result<Self, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source§

impl<A, B, C, D, E> TryFromConn for (A, B, C, D, E)
where A: TryFromConn, <A as TryFromConn>::Error: Handler, B: TryFromConn, <B as TryFromConn>::Error: Handler, C: TryFromConn, <C as TryFromConn>::Error: Handler, D: TryFromConn, <D as TryFromConn>::Error: Handler, E: TryFromConn, <E as TryFromConn>::Error: Handler,

§

type Error = Box<dyn Handler>

source§

fn try_from_conn<'life0, 'async_trait>( conn: &'life0 mut Conn ) -> Pin<Box<dyn Future<Output = Result<Self, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source§

impl<A, B, C, D, E, F> TryFromConn for (A, B, C, D, E, F)
where A: TryFromConn, <A as TryFromConn>::Error: Handler, B: TryFromConn, <B as TryFromConn>::Error: Handler, C: TryFromConn, <C as TryFromConn>::Error: Handler, D: TryFromConn, <D as TryFromConn>::Error: Handler, E: TryFromConn, <E as TryFromConn>::Error: Handler, F: TryFromConn, <F as TryFromConn>::Error: Handler,

§

type Error = Box<dyn Handler>

source§

fn try_from_conn<'life0, 'async_trait>( conn: &'life0 mut Conn ) -> Pin<Box<dyn Future<Output = Result<Self, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source§

impl<A, B, C, D, E, F, G> TryFromConn for (A, B, C, D, E, F, G)
where A: TryFromConn, <A as TryFromConn>::Error: Handler, B: TryFromConn, <B as TryFromConn>::Error: Handler, C: TryFromConn, <C as TryFromConn>::Error: Handler, D: TryFromConn, <D as TryFromConn>::Error: Handler, E: TryFromConn, <E as TryFromConn>::Error: Handler, F: TryFromConn, <F as TryFromConn>::Error: Handler, G: TryFromConn, <G as TryFromConn>::Error: Handler,

§

type Error = Box<dyn Handler>

source§

fn try_from_conn<'life0, 'async_trait>( conn: &'life0 mut Conn ) -> Pin<Box<dyn Future<Output = Result<Self, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source§

impl<A, B, C, D, E, F, G, H> TryFromConn for (A, B, C, D, E, F, G, H)
where A: TryFromConn, <A as TryFromConn>::Error: Handler, B: TryFromConn, <B as TryFromConn>::Error: Handler, C: TryFromConn, <C as TryFromConn>::Error: Handler, D: TryFromConn, <D as TryFromConn>::Error: Handler, E: TryFromConn, <E as TryFromConn>::Error: Handler, F: TryFromConn, <F as TryFromConn>::Error: Handler, G: TryFromConn, <G as TryFromConn>::Error: Handler, H: TryFromConn, <H as TryFromConn>::Error: Handler,

§

type Error = Box<dyn Handler>

source§

fn try_from_conn<'life0, 'async_trait>( conn: &'life0 mut Conn ) -> Pin<Box<dyn Future<Output = Result<Self, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source§

impl<A, B, C, D, E, F, G, H, I> TryFromConn for (A, B, C, D, E, F, G, H, I)
where A: TryFromConn, <A as TryFromConn>::Error: Handler, B: TryFromConn, <B as TryFromConn>::Error: Handler, C: TryFromConn, <C as TryFromConn>::Error: Handler, D: TryFromConn, <D as TryFromConn>::Error: Handler, E: TryFromConn, <E as TryFromConn>::Error: Handler, F: TryFromConn, <F as TryFromConn>::Error: Handler, G: TryFromConn, <G as TryFromConn>::Error: Handler, H: TryFromConn, <H as TryFromConn>::Error: Handler, I: TryFromConn, <I as TryFromConn>::Error: Handler,

§

type Error = Box<dyn Handler>

source§

fn try_from_conn<'life0, 'async_trait>( conn: &'life0 mut Conn ) -> Pin<Box<dyn Future<Output = Result<Self, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source§

impl<A, B, C, D, E, F, G, H, I, J> TryFromConn for (A, B, C, D, E, F, G, H, I, J)
where A: TryFromConn, <A as TryFromConn>::Error: Handler, B: TryFromConn, <B as TryFromConn>::Error: Handler, C: TryFromConn, <C as TryFromConn>::Error: Handler, D: TryFromConn, <D as TryFromConn>::Error: Handler, E: TryFromConn, <E as TryFromConn>::Error: Handler, F: TryFromConn, <F as TryFromConn>::Error: Handler, G: TryFromConn, <G as TryFromConn>::Error: Handler, H: TryFromConn, <H as TryFromConn>::Error: Handler, I: TryFromConn, <I as TryFromConn>::Error: Handler, J: TryFromConn, <J as TryFromConn>::Error: Handler,

§

type Error = Box<dyn Handler>

source§

fn try_from_conn<'life0, 'async_trait>( conn: &'life0 mut Conn ) -> Pin<Box<dyn Future<Output = Result<Self, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source§

impl<A, B, C, D, E, F, G, H, I, J, K> TryFromConn for (A, B, C, D, E, F, G, H, I, J, K)
where A: TryFromConn, <A as TryFromConn>::Error: Handler, B: TryFromConn, <B as TryFromConn>::Error: Handler, C: TryFromConn, <C as TryFromConn>::Error: Handler, D: TryFromConn, <D as TryFromConn>::Error: Handler, E: TryFromConn, <E as TryFromConn>::Error: Handler, F: TryFromConn, <F as TryFromConn>::Error: Handler, G: TryFromConn, <G as TryFromConn>::Error: Handler, H: TryFromConn, <H as TryFromConn>::Error: Handler, I: TryFromConn, <I as TryFromConn>::Error: Handler, J: TryFromConn, <J as TryFromConn>::Error: Handler, K: TryFromConn, <K as TryFromConn>::Error: Handler,

§

type Error = Box<dyn Handler>

source§

fn try_from_conn<'life0, 'async_trait>( conn: &'life0 mut Conn ) -> Pin<Box<dyn Future<Output = Result<Self, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source§

impl<A, B, C, D, E, F, G, H, I, J, K, L> TryFromConn for (A, B, C, D, E, F, G, H, I, J, K, L)
where A: TryFromConn, <A as TryFromConn>::Error: Handler, B: TryFromConn, <B as TryFromConn>::Error: Handler, C: TryFromConn, <C as TryFromConn>::Error: Handler, D: TryFromConn, <D as TryFromConn>::Error: Handler, E: TryFromConn, <E as TryFromConn>::Error: Handler, F: TryFromConn, <F as TryFromConn>::Error: Handler, G: TryFromConn, <G as TryFromConn>::Error: Handler, H: TryFromConn, <H as TryFromConn>::Error: Handler, I: TryFromConn, <I as TryFromConn>::Error: Handler, J: TryFromConn, <J as TryFromConn>::Error: Handler, K: TryFromConn, <K as TryFromConn>::Error: Handler, L: TryFromConn, <L as TryFromConn>::Error: Handler,

§

type Error = Box<dyn Handler>

source§

fn try_from_conn<'life0, 'async_trait>( conn: &'life0 mut Conn ) -> Pin<Box<dyn Future<Output = Result<Self, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Implementors§

source§

impl TryFromConn for Value

§

type Error = Error

source§

impl<T> TryFromConn for Body<T>
where T: DeserializeOwned + Send + Sync + 'static,

§

type Error = Error

source§

impl<T> TryFromConn for Json<T>
where T: DeserializeOwned + Send + Sync + 'static,

§

type Error = Error

source§

impl<T: FromConn> TryFromConn for T

§

type Error = ()