From 224d93f167ab6d4c08ff70e2d82f0a5176200d3e Mon Sep 17 00:00:00 2001 From: Stephen Chung Date: Sat, 13 Feb 2021 23:01:34 +0800 Subject: [PATCH] Add comparison operators for Decimals. --- src/packages/logic.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/packages/logic.rs b/src/packages/logic.rs index f312bc93..deb85c74 100644 --- a/src/packages/logic.rs +++ b/src/packages/logic.rs @@ -1,6 +1,11 @@ +#![allow(non_snake_case)] + use crate::def_package; use crate::plugin::*; +#[cfg(feature = "decimal")] +use rust_decimal::Decimal; + #[cfg(any( not(feature = "no_float"), 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); } + #[cfg(feature = "decimal")] + reg_functions!(lib += decimal; Decimal); + set_exported_fn!(lib, "!", not); }); @@ -95,3 +103,6 @@ gen_cmp_functions!(float => f32); #[cfg(not(feature = "no_float"))] #[cfg(feature = "f32_float")] gen_cmp_functions!(float => f64); + +#[cfg(feature = "decimal")] +gen_cmp_functions!(decimal => Decimal);