Add comparison operators for Decimals.

This commit is contained in:
Stephen Chung 2021-02-13 23:01:34 +08:00
parent 61a01ea957
commit 224d93f167

View File

@ -1,6 +1,11 @@
#![allow(non_snake_case)]
use crate::def_package; use crate::def_package;
use crate::plugin::*; use crate::plugin::*;
#[cfg(feature = "decimal")]
use rust_decimal::Decimal;
#[cfg(any( #[cfg(any(
not(feature = "no_float"), not(feature = "no_float"),
all(not(feature = "only_i32"), not(feature = "only_i64")) all(not(feature = "only_i32"), not(feature = "only_i64"))
@ -70,6 +75,9 @@ def_package!(crate:LogicPackage:"Logical operators.", lib, {
reg_functions!(lib += float; f64); reg_functions!(lib += float; f64);
} }
#[cfg(feature = "decimal")]
reg_functions!(lib += decimal; Decimal);
set_exported_fn!(lib, "!", not); set_exported_fn!(lib, "!", not);
}); });
@ -95,3 +103,6 @@ gen_cmp_functions!(float => f32);
#[cfg(not(feature = "no_float"))] #[cfg(not(feature = "no_float"))]
#[cfg(feature = "f32_float")] #[cfg(feature = "f32_float")]
gen_cmp_functions!(float => f64); gen_cmp_functions!(float => f64);
#[cfg(feature = "decimal")]
gen_cmp_functions!(decimal => Decimal);