Repository navigation
Move remaining decimal adapters into the decimal submodule - #11078
Conversation
99bc867 to
33e20bd
Compare
| /// that exceed the representable range become `INFINITY` or `-INFINITY` without | ||
| /// returning an error. | ||
| #[inline(always)] | ||
| pub fn single_decimal_to_float_lossy<D, F>(f: &F, x: D::Native, scale: i32) -> f64 |
There was a problem hiding this comment.
for this id prefer to leave it here, since its a public function and its small enough anyway
There was a problem hiding this comment.
Done in ca44f58: single_decimal_to_float_lossy stays in cast/mod.rs where it was — the definition no longer appears in the diff. Only the private adapters (cast_from_decimal, cast_to_decimal, cast_integer_to_decimal, integer_to_decimal_native) move into the decimal submodule; its call sites reach the helper through the existing use crate::cast::*.
|
Sounds good — leaving it where it is. |
was a commit supposed to accompany this comment? i see no changes made |
|
No — no commit was intended there: your inline comment on that thread was preferring to keep it where it is ("for this id prefer to leave it here, since its a public function and its small enough anyway"), and my reply was agreeing with that, so nothing changed. Sorry for the confusion — I could have phrased it as "agreed, keeping it as-is". |
i was commenting on the removal, so my comment was intended to say i want to keep the function where it was |
|
see #11076 (comment) |
ca44f58 to
7cac0e5
Compare
Moves `integer_to_decimal_native`, `integers_fit_digits`, `cast_integer_to_decimal`, `cast_from_decimal` and `cast_to_decimal` out of `cast/mod.rs` and into the existing `cast/decimal.rs`, so the decimal cast code lives in one place. This is pure code motion: the moved lines are byte-identical to their definitions on main, and `cast/mod.rs` needs no new declarations because `use crate::cast::decimal::*;` is already there. `cast_from_decimal` and `cast_to_decimal` are called from the dispatch in `cast/mod.rs`, so they become `pub(crate)`. The other three are only reached from the moved code, so they stay private. `single_decimal_to_float_lossy` stays in `cast/mod.rs`.
7cac0e5 to
df86b50
Compare
|
Rebased onto main to fix the conflict. |
Which issue does this PR close?
Rationale for this change
Continues splitting up
cast/mod.rs.What changes are included in this PR?
Moves the remaining decimal adapters (
integer_to_decimal_native,integers_fit_digits,cast_integer_to_decimal,cast_from_decimal,cast_to_decimal) into the existingcast/decimal.rs. Code is unchanged apart frompub(crate)oncast_from_decimalandcast_to_decimal.Are these changes tested?
Covered by existing tests.
Are there any significant user-facing changes?
No.