[][src]Struct nash_protocol::types::exchange::Amount

pub struct Amount {
    pub precision: u32,
    pub value: BigDecimal,
}

Amount encodes the amount of asset being bought or sold in an order It is encoded with a precision that depends on the market and asset being traded. For example, in the ETH/USD market, ETH has a precision of 4. In an A/B market, amount is always in units of A.

Fields

precision: u32value: BigDecimal

Implementations

impl Amount[src]

pub fn to_be_bytes(&self) -> Result<[u8; 8]>[src]

Serialize Amount to Big Endian bytes for ETH payload creation.

pub fn from_bytes(bytes: [u8; 8], precision: u32) -> Result<Self>[src]

Create an amount of given precision from ETH payload bytes

impl Amount[src]

pub fn to_le_bytes(&self) -> Result<[u8; 8]>[src]

Serialize Amount to Little Endian bytes for NEO payload creation.

impl Amount[src]

pub fn new(str_num: &str, precision: u32) -> Result<Self>[src]

Construct a new Amount from string and precision

pub fn from_bigdecimal(value: BigDecimal, precision: u32) -> Self[src]

pub fn to_bigdecimal(&self) -> BigDecimal[src]

Trait Implementations

impl Clone for Amount[src]

impl Debug for Amount[src]

impl<'de> Deserialize<'de> for Amount[src]

impl Eq for Amount[src]

impl PartialEq<Amount> for Amount[src]

impl Serialize for Amount[src]

impl StructuralEq for Amount[src]

impl StructuralPartialEq for Amount[src]

Auto Trait Implementations

impl RefUnwindSafe for Amount

impl Send for Amount

impl Sync for Amount

impl Unpin for Amount

impl UnwindSafe for Amount

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.