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
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
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
Source§impl From<ParseUnits> for U256
impl From<ParseUnits> for U256
Source§fn from(value: ParseUnits) -> Self
fn from(value: ParseUnits) -> Self
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,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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
key
and return true
if they are equal.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> ⓘ
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> ⓘ
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 40 bytes
Size for each variant:
U256
: 32 bytesI256
: 32 bytes