Trait Balance

Source
pub trait Balance {
    type Num: Num + Unsigned<Signed = Self::Signed>;
    type Signed;

    // Required methods
    fn long_amount(&self) -> Result<Self::Num>;
    fn short_amount(&self) -> Result<Self::Num>;
}
Expand description

Balanced amounts.

Required Associated Types§

Source

type Num: Num + Unsigned<Signed = Self::Signed>

Unsigned number type.

Source

type Signed

Signed number type.

Required Methods§

Source

fn long_amount(&self) -> Result<Self::Num>

Get the long token amount (when this is a token balance), or long usd value (when this is a usd value balance).

Source

fn short_amount(&self) -> Result<Self::Num>

Get the short token amount (when this is a token balance), or short usd value (when this is a usd value balance).

Implementations on Foreign Types§

Source§

impl<P: Balance> Balance for &P

Source§

type Num = <P as Balance>::Num

Source§

type Signed = <P as Balance>::Signed

Source§

fn long_amount(&self) -> Result<Self::Num>

Source§

fn short_amount(&self) -> Result<Self::Num>

Implementors§

Source§

impl<A, B, Num, Signed> Balance for Merged<A, B>
where Num: Num + Unsigned<Signed = Signed>, A: Balance<Num = Num, Signed = Signed>, B: Balance<Num = Num, Signed = Signed>,

Source§

type Num = Num

Source§

type Signed = Signed