Trait trillium_api::TryFromConn

source ·
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 TryFromConn for String

§

type Error = Error

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 TryFromConn for Vec<u8>

§

type Error = Error

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> TryFromConn for (A, B)

§

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)

§

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)

§

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)

§

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)

§

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)

§

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)

§

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)

§

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)

§

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)

§

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)

§

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 = ()