pub struct ExchangeRate {
pub base: String,
pub quote: String,
pub rate_numerator: u128,
pub rate_denominator: u128,
pub updated_at: u64,
pub fetched_at: u64,
pub source: String,
pub feed_reference: String,
pub max_age_seconds: u64,
pub conversion_margin_bps: u32,
pub confidence_numerator: Option<u128>,
pub confidence_denominator: Option<u128>,
}Fields§
§base: String§quote: String§rate_numerator: u128§rate_denominator: u128§updated_at: u64§fetched_at: u64§source: String§feed_reference: String§max_age_seconds: u64§conversion_margin_bps: u32§confidence_numerator: Option<u128>§confidence_denominator: Option<u128>Implementations§
Source§impl ExchangeRate
impl ExchangeRate
pub fn pair(&self) -> String
pub fn ensure_matches_pair( &self, pair: &PairConfig, ) -> Result<(), PriceOracleError>
pub fn age_seconds(&self, now: u64) -> u64
pub fn cache_age_seconds(&self, now: u64) -> u64
pub fn ensure_fresh(&self, now: u64) -> Result<(), PriceOracleError>
pub fn backend_label(&self) -> String
pub fn with_degraded_mode( self, max_age_seconds: u64, extra_margin_bps: u32, source_suffix: &str, ) -> Self
pub fn to_conversion_evidence( &self, original_cost_units: u64, original_currency: impl Into<String>, grant_currency: impl Into<String>, converted_cost_units: u64, now: u64, ) -> Result<OracleConversionEvidence, PriceOracleError>
Trait Implementations§
Source§impl Clone for ExchangeRate
impl Clone for ExchangeRate
Source§fn clone(&self) -> ExchangeRate
fn clone(&self) -> ExchangeRate
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ExchangeRate
impl Debug for ExchangeRate
impl Eq for ExchangeRate
Source§impl PartialEq for ExchangeRate
impl PartialEq for ExchangeRate
impl StructuralPartialEq for ExchangeRate
Auto Trait Implementations§
impl Freeze for ExchangeRate
impl RefUnwindSafe for ExchangeRate
impl Send for ExchangeRate
impl Sync for ExchangeRate
impl Unpin for ExchangeRate
impl UnsafeUnpin for ExchangeRate
impl UnwindSafe for ExchangeRate
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more