[][src]Struct exonum::api::With

pub struct With<Q, I, R, F> {
    pub handler: F,
    // some fields omitted
}

API endpoint handler extractor which can extract handler from various entities. The basic idea of this structure is to extract type parameters from the given handler, thus, it becomes possible to distinguish different types of closures in compile time.

For example for handler with signature:

Fn(state: &ServiceApiState, query: MyQuery) -> Result<MyResponse, api::Error>

Extracted types are:

  • Q is MyQuery, i.e. type of query.
  • I is MyResponse, i.e. type of response item.
  • R is Result<I, api::Error>, i.e. complete type of result.

Fields

handler: F

Underlying API handler.

Trait Implementations

impl<Q, I, F> From<F> for With<Q, I, Result<I>, F> where
    F: for<'r> Fn(&'r ServiceApiState, Q) -> Result<I>, 
[src]

impl<Q, I, F> From<F> for With<Q, I, FutureResult<I>, F> where
    F: for<'r> Fn(&'r ServiceApiState, Q) -> FutureResult<I>, 
[src]

impl<Q: Debug, I: Debug, R: Debug, F: Debug> Debug for With<Q, I, R, F>
[src]

Auto Trait Implementations

impl<Q, I, R, F> Send for With<Q, I, R, F> where
    F: Send,
    I: Send,
    Q: Send,
    R: Send

impl<Q, I, R, F> Sync for With<Q, I, R, F> where
    F: Sync,
    I: Sync,
    Q: Sync,
    R: Sync

Blanket Implementations

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Erased for T

impl<T> Erased for T

impl<T> Same for T

type Output = T

Should always be Self