pub struct CollateralExchangeRate(/* private fields */);Expand description
Collateral exchange rate
Implementations§
Source§impl CollateralExchangeRate
impl CollateralExchangeRate
Sourcepub fn collateral_to_liquidity(
&self,
collateral_amount: u64,
) -> Result<u64, ProgramError>
pub fn collateral_to_liquidity( &self, collateral_amount: u64, ) -> Result<u64, ProgramError>
Convert reserve collateral to liquidity
Sourcepub fn decimal_collateral_to_liquidity(
&self,
collateral_amount: Decimal,
) -> Result<Decimal, ProgramError>
pub fn decimal_collateral_to_liquidity( &self, collateral_amount: Decimal, ) -> Result<Decimal, ProgramError>
Convert reserve collateral to liquidity
Sourcepub fn liquidity_to_collateral(
&self,
liquidity_amount: u64,
) -> Result<u64, ProgramError>
pub fn liquidity_to_collateral( &self, liquidity_amount: u64, ) -> Result<u64, ProgramError>
Convert reserve liquidity to collateral
Sourcepub fn decimal_liquidity_to_collateral(
&self,
liquidity_amount: Decimal,
) -> Result<Decimal, ProgramError>
pub fn decimal_liquidity_to_collateral( &self, liquidity_amount: Decimal, ) -> Result<Decimal, ProgramError>
Convert reserve liquidity to collateral
Trait Implementations§
Source§impl Clone for CollateralExchangeRate
impl Clone for CollateralExchangeRate
Source§fn clone(&self) -> CollateralExchangeRate
fn clone(&self) -> CollateralExchangeRate
Returns a duplicate of the value. Read more
1.0.0 · 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 CollateralExchangeRate
impl Debug for CollateralExchangeRate
Source§impl From<CollateralExchangeRate> for Rate
impl From<CollateralExchangeRate> for Rate
Source§fn from(exchange_rate: CollateralExchangeRate) -> Self
fn from(exchange_rate: CollateralExchangeRate) -> Self
Converts to this type from the input type.
impl Copy for CollateralExchangeRate
Auto Trait Implementations§
impl Freeze for CollateralExchangeRate
impl RefUnwindSafe for CollateralExchangeRate
impl Send for CollateralExchangeRate
impl Sync for CollateralExchangeRate
impl Unpin for CollateralExchangeRate
impl UnwindSafe for CollateralExchangeRate
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<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