Trait near_primitives_core::serialize::dec_format::DecType

source ·
pub trait DecType: Sized {
    // Required methods
    fn serialize(&self) -> Option<String>;
    fn try_from_str(value: &str) -> Result<Self, ParseIntError>;
    fn from_u64(value: u64) -> Self;

    // Provided method
    fn try_from_unit() -> Result<Self, ParseUnitError> { ... }
}
Expand description

Abstraction between integers that we serialise.

Required Methods§

source

fn serialize(&self) -> Option<String>

Formats number as a decimal string; passes None as is.

source

fn try_from_str(value: &str) -> Result<Self, ParseIntError>

Tries to parse decimal string as an integer.

source

fn from_u64(value: u64) -> Self

Constructs Self from a 64-bit unsigned integer.

Provided Methods§

source

fn try_from_unit() -> Result<Self, ParseUnitError>

Constructs Self from a null value. Returns error if this type does not accept null values.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl DecType for u64

source§

fn serialize(&self) -> Option<String>

source§

fn try_from_str(value: &str) -> Result<Self, ParseIntError>

source§

fn from_u64(value: u64) -> Self

source§

impl DecType for u128

source§

fn serialize(&self) -> Option<String>

source§

fn try_from_str(value: &str) -> Result<Self, ParseIntError>

source§

fn from_u64(value: u64) -> Self

source§

impl<T: DecType> DecType for Option<T>

Implementors§