Settings
Help

serialize_u64_or_u256

Function serialize_u64_or_u256 

Source
pub fn serialize_u64_or_u256<S>(
    n: &U256,
    serializer: S,
) -> Result<S::Ok, S::Error>
where S: Serializer,
Expand description

Serialize U256 as u64 if it fits, otherwise as a hex string. If the number fits into a i64, serialize it as number without quotation marks. If the number fits into a u64, serialize it as a stringified number with quotation marks. Otherwise, serialize it as a hex string with quotation marks.