[][src]Struct interledger_service::WrappedService

pub struct WrappedService<F, I, A> { /* fields omitted */ }

A service that wraps another one with a function that will be called on every request.

This enables wrapping services without the boilerplate of defining a new struct and implementing IncomingService and/or OutgoingService every time.

Methods

impl<F, IO, A, R> WrappedService<F, IO, A> where
    F: Fn(IncomingRequest<A>, IO) -> R,
    IO: IncomingService<A> + Clone,
    A: Account,
    R: Future<Item = Fulfill, Error = Reject> + Send + 'static, 
[src]

pub fn wrap_incoming(inner: IO, f: F) -> Self[src]

Wrap the given service such that the provided function will be called to handle each request. That function can return immediately, modify the request before passing it on, and/or handle the result of calling the inner service.

impl<F, IO, A, R> WrappedService<F, IO, A> where
    F: Fn(OutgoingRequest<A>, IO) -> R,
    IO: OutgoingService<A> + Clone,
    A: Account,
    R: Future<Item = Fulfill, Error = Reject> + Send + 'static, 
[src]

pub fn wrap_outgoing(inner: IO, f: F) -> Self[src]

Wrap the given service such that the provided function will be called to handle each request. That function can return immediately, modify the request before passing it on, and/or handle the result of calling the inner service.

Trait Implementations

impl<F, IO, A, R> IncomingService<A> for WrappedService<F, IO, A> where
    F: Fn(IncomingRequest<A>, IO) -> R,
    IO: IncomingService<A> + Clone,
    A: Account,
    R: Future<Item = Fulfill, Error = Reject> + Send + 'static, 
[src]

type Future = R

impl<F, IO, A, R> OutgoingService<A> for WrappedService<F, IO, A> where
    F: Fn(OutgoingRequest<A>, IO) -> R,
    IO: OutgoingService<A> + Clone,
    A: Account,
    R: Future<Item = Fulfill, Error = Reject> + Send + 'static, 
[src]

type Future = R

impl<F: Clone, I: Clone, A: Clone> Clone for WrappedService<F, I, A>[src]

Auto Trait Implementations

impl<F, I, A> Send for WrappedService<F, I, A> where
    A: Send,
    F: Send,
    I: Send + Sync

impl<F, I, A> Sync for WrappedService<F, I, A> where
    A: Sync,
    F: Sync,
    I: Send + Sync

impl<F, I, A> Unpin for WrappedService<F, I, A> where
    A: Unpin,
    F: Unpin

impl<F, I, A> UnwindSafe for WrappedService<F, I, A> where
    A: UnwindSafe,
    F: UnwindSafe,
    I: RefUnwindSafe

impl<F, I, A> RefUnwindSafe for WrappedService<F, I, A> where
    A: RefUnwindSafe,
    F: RefUnwindSafe,
    I: RefUnwindSafe

Blanket Implementations

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

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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<T> Borrow<T> for T where
    T: ?Sized
[src]

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

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