NativeDecimalType

Trait NativeDecimalType 

Source
pub trait NativeDecimalType:
    Send
    + Sync
    + Clone
    + Copy
    + Debug
    + Display
    + Default
    + RefUnwindSafe
    + Eq
    + Ord
    + BigCast
    + 'static {
    const DECIMAL_TYPE: DecimalType;
    const MAX_PRECISION: u8;
    const MAX_SCALE: i8;
    const MIN_BY_PRECISION: &'static [Self];
    const MAX_BY_PRECISION: &'static [Self];

    // Required methods
    fn downcast<V: DecimalTypeDowncast>(visitor: V) -> V::Output<Self>;
    fn upcast<V: DecimalTypeUpcast>(input: V::Input<Self>) -> V;
}
Expand description

Type of decimal scalar values.

This trait is implemented by native integer types that can be used to store decimal values.

Required Associated Constants§

Source

const DECIMAL_TYPE: DecimalType

The decimal value type corresponding to this native type.

Source

const MAX_PRECISION: u8

The maximum precision supported by this decimal type.

Source

const MAX_SCALE: i8

The maximum scale supported by this decimal type.

Source

const MIN_BY_PRECISION: &'static [Self]

The minimum value for each precision supported by this decimal type. This is an array of length MAX_PRECISION + 1 where the ith element is the minimum value for a precision of i (including precision 0).

Source

const MAX_BY_PRECISION: &'static [Self]

The maximum value for each precision supported by this decimal type. similar to MIN_BY_PRECISION.

Required Methods§

Source

fn downcast<V: DecimalTypeDowncast>(visitor: V) -> V::Output<Self>

Downcast the provided object to a type-specific instance.

Source

fn upcast<V: DecimalTypeUpcast>(input: V::Input<Self>) -> V

Upcast a type-specific instance to a generic instance.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl NativeDecimalType for i8

Source§

const DECIMAL_TYPE: DecimalType = DecimalType::I8

Source§

const MAX_PRECISION: u8 = 2u8

Source§

const MAX_SCALE: i8 = 2i8

Source§

const MIN_BY_PRECISION: &'static [Self]

Source§

const MAX_BY_PRECISION: &'static [Self]

Source§

fn downcast<V: DecimalTypeDowncast>(visitor: V) -> V::Output<Self>

Source§

fn upcast<V: DecimalTypeUpcast>(input: V::Input<Self>) -> V

Source§

impl NativeDecimalType for i16

Source§

const DECIMAL_TYPE: DecimalType = DecimalType::I16

Source§

const MAX_PRECISION: u8 = 4u8

Source§

const MAX_SCALE: i8 = 4i8

Source§

const MIN_BY_PRECISION: &'static [Self]

Source§

const MAX_BY_PRECISION: &'static [Self]

Source§

fn downcast<V: DecimalTypeDowncast>(visitor: V) -> V::Output<Self>

Source§

fn upcast<V: DecimalTypeUpcast>(input: V::Input<Self>) -> V

Source§

impl NativeDecimalType for i32

Source§

const DECIMAL_TYPE: DecimalType = DecimalType::I32

Source§

const MAX_PRECISION: u8 = 9u8

Source§

const MAX_SCALE: i8 = 9i8

Source§

const MIN_BY_PRECISION: &'static [Self]

Source§

const MAX_BY_PRECISION: &'static [Self]

Source§

fn downcast<V: DecimalTypeDowncast>(visitor: V) -> V::Output<Self>

Source§

fn upcast<V: DecimalTypeUpcast>(input: V::Input<Self>) -> V

Source§

impl NativeDecimalType for i64

Source§

const DECIMAL_TYPE: DecimalType = DecimalType::I64

Source§

const MAX_PRECISION: u8 = 18u8

Source§

const MAX_SCALE: i8 = 18i8

Source§

const MIN_BY_PRECISION: &'static [Self]

Source§

const MAX_BY_PRECISION: &'static [Self]

Source§

fn downcast<V: DecimalTypeDowncast>(visitor: V) -> V::Output<Self>

Source§

fn upcast<V: DecimalTypeUpcast>(input: V::Input<Self>) -> V

Source§

impl NativeDecimalType for i128

Source§

const DECIMAL_TYPE: DecimalType = DecimalType::I128

Source§

const MAX_PRECISION: u8 = 38u8

Source§

const MAX_SCALE: i8 = 38i8

Source§

const MIN_BY_PRECISION: &'static [Self]

Source§

const MAX_BY_PRECISION: &'static [Self]

Source§

fn downcast<V: DecimalTypeDowncast>(visitor: V) -> V::Output<Self>

Source§

fn upcast<V: DecimalTypeUpcast>(input: V::Input<Self>) -> V

Implementors§

Source§

impl NativeDecimalType for i256

Source§

const DECIMAL_TYPE: DecimalType = DecimalType::I256

Source§

const MAX_PRECISION: u8 = 76u8

Source§

const MAX_SCALE: i8 = 76i8

Source§

const MIN_BY_PRECISION: &'static [Self]

Source§

const MAX_BY_PRECISION: &'static [Self]