pub enum Rate {
OrderRate(OrderRate),
MaxOrderRate,
MinOrderRate,
FeeRate(OrderRate),
MaxFeeRate,
MinFeeRate,
}Expand description
The Rate enum describes behavior common to rates/prices.
Variants§
Implementations§
Source§impl Rate
impl Rate
Sourcepub fn to_le_bytes(&self) -> Result<[u8; 8]>
pub fn to_le_bytes(&self) -> Result<[u8; 8]>
Convert any Rate into bytes for encoding in a NEO payload
Source§impl Rate
impl Rate
Sourcepub fn to_bigdecimal(&self) -> Result<BigDecimal>
pub fn to_bigdecimal(&self) -> Result<BigDecimal>
Return new bigdecimal inner value based on Rate
pub fn invert_rate(&self, precision: Option<u32>) -> Result<Self>
Sourcepub fn subtract_fee(&self, fee: BigDecimal) -> Result<OrderRate>
pub fn subtract_fee(&self, fee: BigDecimal) -> Result<OrderRate>
Subtract fee from user by adjusting the order rate downwards
Trait Implementations§
Source§impl From<OrderRate> for Rate
Enum wrappers are kind of annoying. This allows us to use .into()
on a value to generate a wrapped value. For example:
OrderRate::new("1").unwrap().into() => Rate::OrderRate(...)
impl From<OrderRate> for Rate
Enum wrappers are kind of annoying. This allows us to use .into()
on a value to generate a wrapped value. For example:
OrderRate::new("1").unwrap().into() => Rate::OrderRate(...)
impl StructuralPartialEq for Rate
Auto Trait Implementations§
impl Freeze for Rate
impl RefUnwindSafe for Rate
impl Send for Rate
impl Sync for Rate
impl Unpin for Rate
impl UnwindSafe for Rate
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> 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