pub enum ParseUnits {
U256(U256),
I256(I256),
}
Expand description
This enum holds the numeric types that a possible to be returned by parse_units
and
that are taken by format_units
.
Variants§
Implementations§
Source§impl ParseUnits
impl ParseUnits
Sourcepub fn parse_units(amount: &str, unit: Unit) -> Result<Self, UnitsError>
pub fn parse_units(amount: &str, unit: Unit) -> Result<Self, UnitsError>
Parses a decimal number and multiplies it with 10^units.
See parse_units
for more information.
Sourcepub fn format_units(&self, unit: Unit) -> String
pub fn format_units(&self, unit: Unit) -> String
Formats the given number of Wei as the given unit.
See format_units
for more information.
Sourcepub const fn is_unsigned(&self) -> bool
pub const fn is_unsigned(&self) -> bool
Returns true
if the number is unsigned.
Sourcepub const fn is_negative(&self) -> bool
pub const fn is_negative(&self) -> bool
Returns true
if the number is negative.
Sourcepub const fn is_positive(&self) -> bool
pub const fn is_positive(&self) -> bool
Returns true
if the number is positive.
Sourcepub const fn get_absolute(self) -> U256
pub const fn get_absolute(self) -> U256
Returns the absolute value of the number.
Sourcepub const fn get_signed(self) -> I256
pub const fn get_signed(self) -> I256
Returns the signed value of the number.
Trait Implementations§
Source§impl Clone for ParseUnits
impl Clone for ParseUnits
Source§fn clone(&self) -> ParseUnits
fn clone(&self) -> ParseUnits
Returns a copy 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 ParseUnits
impl Debug for ParseUnits
Source§impl Display for ParseUnits
impl Display for ParseUnits
Source§impl From<ParseUnits> for I256
impl From<ParseUnits> for I256
Source§fn from(value: ParseUnits) -> Self
fn from(value: ParseUnits) -> Self
Converts to this type from the input type.
Source§impl From<ParseUnits> for U256
impl From<ParseUnits> for U256
Source§fn from(value: ParseUnits) -> Self
fn from(value: ParseUnits) -> Self
Converts to this type from the input type.
Source§impl From<Signed<256, 4>> for ParseUnits
impl From<Signed<256, 4>> for ParseUnits
Source§impl From<Uint<256, 4>> for ParseUnits
impl From<Uint<256, 4>> for ParseUnits
Source§impl From<i128> for ParseUnits
impl From<i128> for ParseUnits
Source§impl From<i16> for ParseUnits
impl From<i16> for ParseUnits
Source§impl From<i32> for ParseUnits
impl From<i32> for ParseUnits
Source§impl From<i64> for ParseUnits
impl From<i64> for ParseUnits
Source§impl From<i8> for ParseUnits
impl From<i8> for ParseUnits
Source§impl From<isize> for ParseUnits
impl From<isize> for ParseUnits
Source§impl From<u128> for ParseUnits
impl From<u128> for ParseUnits
Source§impl From<u16> for ParseUnits
impl From<u16> for ParseUnits
Source§impl From<u32> for ParseUnits
impl From<u32> for ParseUnits
Source§impl From<u64> for ParseUnits
impl From<u64> for ParseUnits
Source§impl From<u8> for ParseUnits
impl From<u8> for ParseUnits
Source§impl From<usize> for ParseUnits
impl From<usize> for ParseUnits
Source§impl Ord for ParseUnits
impl Ord for ParseUnits
Source§fn cmp(&self, other: &ParseUnits) -> Ordering
fn cmp(&self, other: &ParseUnits) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for ParseUnits
impl PartialEq for ParseUnits
Source§impl PartialOrd for ParseUnits
impl PartialOrd for ParseUnits
Source§impl TryFrom<ParseUnits> for u128
impl TryFrom<ParseUnits> for u128
Source§impl TryFrom<ParseUnits> for u64
impl TryFrom<ParseUnits> for u64
impl Copy for ParseUnits
impl Eq for ParseUnits
impl StructuralPartialEq for ParseUnits
Auto Trait Implementations§
impl Freeze for ParseUnits
impl RefUnwindSafe for ParseUnits
impl Send for ParseUnits
impl Sync for ParseUnits
impl Unpin for ParseUnits
impl UnwindSafe for ParseUnits
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.