diff --git a/lib/src/sql/number.rs b/lib/src/sql/number.rs index 07ae865c..4556c662 100644 --- a/lib/src/sql/number.rs +++ b/lib/src/sql/number.rs @@ -29,91 +29,79 @@ pub enum Number { impl Default for Number { fn default() -> Self { - Number::Decimal(Decimal::from(0)) + Number::Int(0) } } impl From for Number { fn from(i: i8) -> Self { - Number::Decimal(Decimal::from(i)) + Number::Int(i as i64) } } impl From for Number { fn from(i: i16) -> Self { - Number::Decimal(Decimal::from(i)) + Number::Int(i as i64) } } impl From for Number { fn from(i: i32) -> Self { - Number::Decimal(Decimal::from(i)) + Number::Int(i as i64) } } impl From for Number { fn from(i: i64) -> Self { - Number::Decimal(Decimal::from(i)) - } -} - -impl From for Number { - fn from(i: i128) -> Self { - Number::Decimal(Decimal::from(i)) + Number::Int(i as i64) } } impl From for Number { fn from(i: isize) -> Self { - Number::Decimal(Decimal::from(i)) + Number::Int(i as i64) } } impl From for Number { fn from(i: u8) -> Self { - Number::Decimal(Decimal::from(i)) + Number::Int(i as i64) } } impl From for Number { fn from(i: u16) -> Self { - Number::Decimal(Decimal::from(i)) + Number::Int(i as i64) } } impl From for Number { fn from(i: u32) -> Self { - Number::Decimal(Decimal::from(i)) + Number::Int(i as i64) } } impl From for Number { fn from(i: u64) -> Self { - Number::Decimal(Decimal::from(i)) - } -} - -impl From for Number { - fn from(i: u128) -> Self { - Number::Decimal(Decimal::from(i)) + Number::Int(i as i64) } } impl From for Number { fn from(i: usize) -> Self { - Number::Decimal(Decimal::from(i)) + Number::Int(i as i64) } } impl From for Number { fn from(f: f32) -> Self { - Number::Decimal(Decimal::from_f32(f).unwrap_or_default()) + Number::Float(f as f64) } } impl From for Number { fn from(f: f64) -> Self { - Number::Decimal(Decimal::from_f64(f).unwrap_or_default()) + Number::Float(f as f64) } }