pub trait FromConn: Send + Sync + Sized + 'static {
    // Required method
    fn from_conn<'life0, 'async_trait>(
        conn: &'life0 mut Conn
    ) -> Pin<Box<dyn Future<Output = Option<Self>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

A trait to extract content from [Conn]s to be used as the second argument to an api handler. Implement this for your types.

Required Methods§

source

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

returning None from this will not call the api handler, but will halt the conn.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl FromConn for ()

source§

fn from_conn<'life0, 'async_trait>( _: &'life0 mut Conn ) -> Pin<Box<dyn Future<Output = Option<Self>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source§

impl FromConn for String

source§

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

source§

impl FromConn for Vec<u8>

source§

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

source§

impl<E: FromConn> FromConn for Option<E>

source§

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

source§

impl<T, E> FromConn for Result<T, E>
where T: TryFromConn<Error = E>, E: Send + Sync + 'static,

source§

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

Implementors§

source§

impl FromConn for Error

source§

impl<T> FromConn for State<T>
where T: Send + Sync + 'static,