[−][src]Struct interledger_service::WrappedService
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]
F: Fn(IncomingRequest<A>, IO) -> R,
IO: IncomingService<A> + Clone,
A: Account,
R: Future<Item = Fulfill, Error = Reject> + Send + 'static,
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]
F: Fn(OutgoingRequest<A>, IO) -> R,
IO: OutgoingService<A> + Clone,
A: Account,
R: Future<Item = Fulfill, Error = Reject> + Send + 'static,
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]
F: Fn(IncomingRequest<A>, IO) -> R,
IO: IncomingService<A> + Clone,
A: Account,
R: Future<Item = Fulfill, Error = Reject> + Send + 'static,
type Future = R
fn handle_request(&mut self, request: IncomingRequest<A>) -> R
[src]
fn wrap<F, R>(self, f: F) -> WrappedService<F, Self, A> where
F: Fn(IncomingRequest<A>, Self) -> R,
R: Future<Item = Fulfill, Error = Reject> + Send + 'static,
Self: Clone + Sized,
[src]
F: Fn(IncomingRequest<A>, Self) -> R,
R: Future<Item = Fulfill, Error = Reject> + Send + 'static,
Self: Clone + Sized,
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]
F: Fn(OutgoingRequest<A>, IO) -> R,
IO: OutgoingService<A> + Clone,
A: Account,
R: Future<Item = Fulfill, Error = Reject> + Send + 'static,
type Future = R
fn send_request(&mut self, request: OutgoingRequest<A>) -> R
[src]
fn wrap<F, R>(self, f: F) -> WrappedService<F, Self, A> where
F: Fn(OutgoingRequest<A>, Self) -> R,
R: Future<Item = Fulfill, Error = Reject> + Send + 'static,
Self: Clone + Sized,
[src]
F: Fn(OutgoingRequest<A>, Self) -> R,
R: Future<Item = Fulfill, Error = Reject> + Send + 'static,
Self: Clone + Sized,
impl<F: Clone, I: Clone, A: Clone> Clone for WrappedService<F, I, A>
[src]
fn clone(&self) -> WrappedService<F, I, A>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Auto Trait Implementations
impl<F, I, A> Send for WrappedService<F, I, A> where
A: Send,
F: Send,
I: Send + Sync,
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,
A: Sync,
F: Sync,
I: Send + Sync,
impl<F, I, A> Unpin for WrappedService<F, I, A> where
A: Unpin,
F: Unpin,
A: Unpin,
F: Unpin,
impl<F, I, A> UnwindSafe for WrappedService<F, I, A> where
A: UnwindSafe,
F: UnwindSafe,
I: RefUnwindSafe,
A: UnwindSafe,
F: UnwindSafe,
I: RefUnwindSafe,
impl<F, I, A> RefUnwindSafe for WrappedService<F, I, A> where
A: RefUnwindSafe,
F: RefUnwindSafe,
I: RefUnwindSafe,
A: RefUnwindSafe,
F: RefUnwindSafe,
I: RefUnwindSafe,
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,