From 3c30a2bffb9da53dd1202837ae72200370e7ab1e Mon Sep 17 00:00:00 2001 From: Chung Date: Thu, 7 Nov 2024 05:30:12 +1100 Subject: [PATCH] complete implementation of IntoAttributeValue for number types (#3169) --- packages/core/src/nodes.rs | 47 +++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/packages/core/src/nodes.rs b/packages/core/src/nodes.rs index e7bafa182..10f9dd514 100644 --- a/packages/core/src/nodes.rs +++ b/packages/core/src/nodes.rs @@ -1036,6 +1036,16 @@ impl IntoAttributeValue for f64 { } } +impl IntoAttributeValue for i8 { + fn into_value(self) -> AttributeValue { + AttributeValue::Int(self as _) + } +} +impl IntoAttributeValue for i16 { + fn into_value(self) -> AttributeValue { + AttributeValue::Int(self as _) + } +} impl IntoAttributeValue for i32 { fn into_value(self) -> AttributeValue { AttributeValue::Int(self as _) @@ -1046,13 +1056,48 @@ impl IntoAttributeValue for i64 { AttributeValue::Int(self) } } - +impl IntoAttributeValue for isize { + fn into_value(self) -> AttributeValue { + AttributeValue::Int(self as _) + } +} impl IntoAttributeValue for i128 { fn into_value(self) -> AttributeValue { AttributeValue::Int(self as _) } } +impl IntoAttributeValue for u8 { + fn into_value(self) -> AttributeValue { + AttributeValue::Int(self as _) + } +} +impl IntoAttributeValue for u16 { + fn into_value(self) -> AttributeValue { + AttributeValue::Int(self as _) + } +} +impl IntoAttributeValue for u32 { + fn into_value(self) -> AttributeValue { + AttributeValue::Int(self as _) + } +} +impl IntoAttributeValue for u64 { + fn into_value(self) -> AttributeValue { + AttributeValue::Int(self as _) + } +} +impl IntoAttributeValue for usize { + fn into_value(self) -> AttributeValue { + AttributeValue::Int(self as _) + } +} +impl IntoAttributeValue for u128 { + fn into_value(self) -> AttributeValue { + AttributeValue::Int(self as _) + } +} + impl IntoAttributeValue for bool { fn into_value(self) -> AttributeValue { AttributeValue::Bool(self)