[][src]Struct exonum_api::With

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

API endpoint handler extractor which can extract a 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. This structure allows applying anonymous functions to endpoints.

For example, for a handler with signature:

Fn(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.

actuality: Actuality

Endpoint actuality.

Trait Implementations

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

impl<'a, Q, I, R, F> From<Deprecated<Q, I, R, F>> for With<Q, I, R, F>[src]

impl<Q, I, R, F> From<F> for With<Q, I, R, F> where
    F: Fn(Q) -> R,
    R: Future<Output = Result<I>>, 
[src]

Auto Trait Implementations

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

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

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

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

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,