BigDecimalExt

Trait BigDecimalExt 

Source
pub trait BigDecimalExt {
    // Required methods
    fn precision(&self) -> u64;
    fn scale(&self) -> i64;
    fn try_into_bigint_with_precision_and_scale(
        &self,
        precision: u8,
        scale: i8,
    ) -> Result<BigInt, IntermediateDecimalError>;
}
Expand description

Extension trait for BigDecimal to provide additional functionality specific to Proof of SQL.

Required Methods§

Source

fn precision(&self) -> u64

Get the precision of the fixed-point representation of this decimal.

Source

fn scale(&self) -> i64

Get the scale of the fixed-point representation of this decimal.

Source

fn try_into_bigint_with_precision_and_scale( &self, precision: u8, scale: i8, ) -> Result<BigInt, IntermediateDecimalError>

Attempts to convert the decimal to BigInt while adjusting it to the specified precision and scale.

Implementations on Foreign Types§

Source§

impl BigDecimalExt for BigDecimal

Source§

fn precision(&self) -> u64

Get the precision of the fixed-point representation of this intermediate decimal.

Source§

fn scale(&self) -> i64

Get the scale of the fixed-point representation of this intermediate decimal.

Source§

fn try_into_bigint_with_precision_and_scale( &self, precision: u8, scale: i8, ) -> Result<BigInt, IntermediateDecimalError>

Attempts to convert the decimal to BigInt while adjusting it to the specified precision and scale. Returns an error if the conversion cannot be performed due to precision or scale constraints.

§Errors

Returns an IntermediateDecimalError::LossyCast error if the number of digits in the scaled decimal exceeds the specified precision.

Implementors§