Enum tp_rpc::number::NumberOrHex[][src]

pub enum NumberOrHex {
    Number(u64),
    Hex(U256),
}

A number type that can be serialized both as a number or a string that encodes a number in a string.

We allow two representations of the block number as input. Either we deserialize to the type that is specified in the block type or we attempt to parse given hex value.

The primary motivation for having this type is to avoid overflows when using big integers in JavaScript (which we consider as an important RPC API consumer).

Variants

Number(u64)

The number represented directly.

Hex(U256)

Hex representation of the number.

Implementations

impl NumberOrHex[src]

pub fn into_u256(self) -> U256[src]

Converts this number into an U256.

Trait Implementations

impl Clone for NumberOrHex[src]

impl Copy for NumberOrHex[src]

impl Debug for NumberOrHex[src]

impl Default for NumberOrHex[src]

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

impl From<U256> for NumberOrHex[src]

impl From<u128> for NumberOrHex[src]

impl From<u32> for NumberOrHex[src]

impl From<u64> for NumberOrHex[src]

impl PartialEq<NumberOrHex> for NumberOrHex[src]

impl Serialize for NumberOrHex[src]

impl StructuralPartialEq for NumberOrHex[src]

Auto Trait Implementations

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<T> Downcast for T where
    T: Any

impl<T> DowncastSync for T where
    T: Any + Send + Sync

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

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

impl<T> Instrument for T[src]

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

impl<T, Outer> IsWrappedBy<Outer> for T where
    T: From<Outer>,
    Outer: AsRef<T> + AsMut<T> + From<T>, 
[src]

pub fn from_ref(outer: &Outer) -> &T[src]

Get a reference to the inner from the outer.

pub fn from_mut(outer: &mut Outer) -> &mut T[src]

Get a mutable reference to the inner from the outer.

impl<T> MaybeDebug for T where
    T: Debug

impl<T> MaybeRefUnwindSafe for T where
    T: RefUnwindSafe

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.

impl<S, T> UncheckedInto<T> for S where
    T: UncheckedFrom<S>, 
[src]

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,