Enum sp_rpc::number::NumberOrHex [−][src]
pub enum NumberOrHex { Number(u64), Hex(U256), }
Expand description
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 representation of the number.
Implementations
Trait Implementations
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Performs the conversion.
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
type Error = TryFromIntError
type Error = TryFromIntError
The type returned in the event of a conversion error.
type Error = TryFromIntError
type Error = TryFromIntError
The type returned in the event of a conversion error.
type Error = TryFromIntError
type Error = TryFromIntError
The type returned in the event of a conversion error.
Auto Trait Implementations
impl RefUnwindSafe for NumberOrHex
impl Send for NumberOrHex
impl Sync for NumberOrHex
impl Unpin for NumberOrHex
impl UnwindSafe for NumberOrHex
Blanket Implementations
Mutably borrows from an owned value. Read more
impl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
Convert Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read more
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
type Output = T
type Output = T
Should always be Self
The counterpart to unchecked_from
.
pub fn vzip(self) -> V
impl<T> MaybeDebug for T where
T: Debug,