[−][src]Struct interledger_service_util::ExchangeRateService
Exchange Rates Service
Responsible for getting the exchange rates for the two assets in the outgoing request (request.from.asset_code
, request.to.asset_code
).
Requires a ExchangeRateStore
Methods
impl<S, O, A> ExchangeRateService<S, O, A> where
S: AddressStore + ExchangeRateStore,
O: OutgoingService<A>,
A: Account,
[src]
S: AddressStore + ExchangeRateStore,
O: OutgoingService<A>,
A: Account,
Trait Implementations
impl<S: Clone, O: Clone, A: Clone> Clone for ExchangeRateService<S, O, A>
[src]
fn clone(&self) -> ExchangeRateService<S, O, A>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<S, O, A> OutgoingService<A> for ExchangeRateService<S, O, A> where
S: AddressStore + ExchangeRateStore + Clone + Send + Sync + 'static,
O: OutgoingService<A> + Send + Clone + 'static,
A: Account + Sync + 'static,
[src]
S: AddressStore + ExchangeRateStore + Clone + Send + Sync + 'static,
O: OutgoingService<A> + Send + Clone + 'static,
A: Account + Sync + 'static,
type Future = BoxedIlpFuture
fn send_request(
&mut self,
request: OutgoingRequest<A>
) -> Box<dyn Future<Item = Fulfill, Error = Reject> + Send>
[src]
&mut self,
request: OutgoingRequest<A>
) -> Box<dyn Future<Item = Fulfill, Error = Reject> + Send>
On send request:
- If the prepare packet's amount is 0, it just forwards
- Retrieves the exchange rate from the store (the store independently is responsible for polling the rates)
- return reject if the call to the store fails
- Calculates the exchange rate AND scales it up/down depending on how many decimals each asset requires
- Updates the amount in the prepare packet and forwards it
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,
[src]
F: Fn(OutgoingRequest<A>, Self) -> R,
R: Future<Item = Fulfill, Error = Reject> + Send + 'static,
Self: Clone,
Auto Trait Implementations
impl<S, O, A> Send for ExchangeRateService<S, O, A> where
A: Send,
O: Send,
S: Send,
A: Send,
O: Send,
S: Send,
impl<S, O, A> Sync for ExchangeRateService<S, O, A> where
A: Sync,
O: Sync,
S: Sync,
A: Sync,
O: Sync,
S: Sync,
impl<S, O, A> Unpin for ExchangeRateService<S, O, A> where
A: Unpin,
O: Unpin,
S: Unpin,
A: Unpin,
O: Unpin,
S: Unpin,
impl<S, O, A> UnwindSafe for ExchangeRateService<S, O, A> where
A: UnwindSafe,
O: UnwindSafe,
S: UnwindSafe,
A: UnwindSafe,
O: UnwindSafe,
S: UnwindSafe,
impl<S, O, A> RefUnwindSafe for ExchangeRateService<S, O, A> where
A: RefUnwindSafe,
O: RefUnwindSafe,
S: RefUnwindSafe,
A: RefUnwindSafe,
O: RefUnwindSafe,
S: 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,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
U: TryFrom<T>,