Rescales `n` to the scale required by `constraints`, if any.
(
mut n: OrderedDecimal<mz_repr_numeric::Numeric>,
constraints: Option<&NumericConstraints>,
)
| 939 | |
| 940 | /// Rescales `n` to the scale required by `constraints`, if any. |
| 941 | fn rescale_numeric( |
| 942 | mut n: OrderedDecimal<mz_repr_numeric::Numeric>, |
| 943 | constraints: Option<&NumericConstraints>, |
| 944 | ) -> Result<OrderedDecimal<mz_repr_numeric::Numeric>, Box<dyn Error + Sync + Send>> { |
| 945 | if let Some(constraints) = constraints { |
| 946 | rescale( |
| 947 | &mut n.0, |
| 948 | NumericMaxScale::try_from(i64::from(constraints.max_scale()))?.into_u8(), |
| 949 | )?; |
| 950 | } |
| 951 | Ok(n) |
| 952 | } |
| 953 | |
| 954 | fn encode_element(buf: &mut BytesMut, elem: Option<&Value>, ty: &Type) -> Result<(), io::Error> { |
| 955 | match elem { |
no test coverage detected