Skip to content

Commit

Permalink
feat: add new datatype into macro.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
ChobobDev committed Nov 26, 2022
1 parent 45e8159 commit 784cdcc
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
30 changes: 30 additions & 0 deletions core/src/data/value/binary_op/integer/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,36 @@ macro_rules! impl_method {
}
.into()
}),
U32(rhs) => $lhs
.$method($lhs_primitive::try_from($rhs)?)
.ok_or_else(|| {
ValueError::BinaryOperationOverflow {
lhs: $lhs_variant($lhs),
rhs: U32(rhs),
operator: $op,
}
.into()
}),
U64(rhs) => $lhs
.$method($lhs_primitive::try_from($rhs)?)
.ok_or_else(|| {
ValueError::BinaryOperationOverflow {
lhs: $lhs_variant($lhs),
rhs: U64(rhs),
operator: $op,
}
.into()
}),
U128(rhs) => $lhs
.$method($lhs_primitive::try_from($rhs)?)
.ok_or_else(|| {
ValueError::BinaryOperationOverflow {
lhs: $lhs_variant($lhs),
rhs: U128(rhs),
operator: $op,
}
.into()
}),
F64(rhs) => $lhs
.$method($lhs_primitive::try_from($rhs)?)
.ok_or_else(|| {
Expand Down
3 changes: 3 additions & 0 deletions core/src/data/value/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ pub enum Value {
I128(i128),
U8(u8),
U16(u16),
U32(u32),
U64(u64),
U128(u128),
F64(f64),
Decimal(Decimal),
Str(String),
Expand Down

0 comments on commit 784cdcc

Please sign in to comment.