Pushes a `Datum::Range` derived from the `Range `. # Panics - If lower and upper express finite values and they are datums of different types. - If lower or upper express finite values and are equal to `Datum::Null`. To handle `Datum::Null` properly, use [`RangeBound::new`]. # Notes - This function canonicalizes the range before pushing it to the row. - Prefer this function over `push_r
(&mut self, mut range: Range<Datum<'a>>)
| 2713 | /// - Prefer creating [`RangeBound`]s using [`RangeBound::new`], which |
| 2714 | /// handles `Datum::Null` in a SQL-friendly way. |
| 2715 | pub fn push_range<'a>(&mut self, mut range: Range<Datum<'a>>) -> Result<(), InvalidRangeError> { |
| 2716 | range.canonicalize()?; |
| 2717 | match range.inner { |
| 2718 | None => { |
| 2719 | self.row.data.push(Tag::Range.into()); |
| 2720 | // Untagged bytes only contains the `RANGE_EMPTY` flag value. |
| 2721 | self.row.data.push(range::InternalFlags::EMPTY.bits()); |
| 2722 | Ok(()) |
| 2723 | } |
| 2724 | Some(inner) => self.push_range_with( |
| 2725 | RangeLowerBound { |
| 2726 | inclusive: inner.lower.inclusive, |
| 2727 | bound: inner |
| 2728 | .lower |
| 2729 | .bound |
| 2730 | .map(|value| move |row: &mut RowPacker| Ok(row.push(value))), |
| 2731 | }, |
| 2732 | RangeUpperBound { |
| 2733 | inclusive: inner.upper.inclusive, |
| 2734 | bound: inner |
| 2735 | .upper |
| 2736 | .bound |
| 2737 | .map(|value| move |row: &mut RowPacker| Ok(row.push(value))), |
| 2738 | }, |
| 2739 | ), |
| 2740 | } |
| 2741 | } |
| 2742 | |
| 2743 | /// Pushes a `DatumRange` built from the specified arguments. |
| 2744 | /// |
no test coverage detected