pub struct Converter { /* private fields */ }Expand description
Fixed-point to decimal converter.
Implementations§
Source§impl Converter
impl Converter
Sourcepub fn new(decimals: u8) -> Self
pub fn new(decimals: u8) -> Self
Fixed-point converter for decimals decimal places. pub to match the
other public constructors, so callers can build one directly.
pub fn decimals(&self) -> u8
pub fn scale<const N: usize>(&self) -> UnsignedDecimal<N>
pub fn from_unsigned<const N: usize>(&self, value: U256) -> UnsignedDecimal<N>
pub fn from_u64<const N: usize>(&self, value: u64) -> UnsignedDecimal<N>
pub fn from_signed<const N: usize>(&self, value: I256) -> Decimal<N>
pub fn from_i64<const N: usize>(&self, value: i64) -> Decimal<N>
pub fn to_unsigned<const N: usize>(&self, value: UnsignedDecimal<N>) -> U256
pub fn to_signed<const N: usize>(&self, value: Decimal<N>) -> I256
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Converter
impl RefUnwindSafe for Converter
impl Send for Converter
impl Sync for Converter
impl Unpin for Converter
impl UnsafeUnpin for Converter
impl UnwindSafe for Converter
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