Trait FromConn

Source
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.

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 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 Headers

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 Method

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,