Construct a projection of the row at `self` by extracting the `cols`. If `cols` contains zero or more than one column, the values of the projected columns are wrapped in a [`ProductValue`]. If `cols` is a single column, the value of that column is returned without wrapping in a `ProductValue`. # Safety - `cols` must not specify any column which is out-of-bounds for the row `self´.
(self, cols: &ColList)
| 1831 | /// |
| 1832 | /// - `cols` must not specify any column which is out-of-bounds for the row `self´. |
| 1833 | pub unsafe fn project_unchecked(self, cols: &ColList) -> AlgebraicValue { |
| 1834 | let col_layouts = self.row_layout().product().elements; |
| 1835 | |
| 1836 | if let Some(head) = cols.as_singleton() { |
| 1837 | let head = head.idx(); |
| 1838 | // SAFETY: caller promised that `head` is in-bounds of `col_layouts`. |
| 1839 | let col_layout = unsafe { col_layouts.get_unchecked(head) }; |
| 1840 | // SAFETY: |
| 1841 | // - `col_layout` was just derived from the row layout. |
| 1842 | // - `AlgebraicValue` is compatible with any `col_layout`. |
| 1843 | // - `self` is a valid row and offsetting to `col_layout` is valid. |
| 1844 | return unsafe { AlgebraicValue::unchecked_read_column(self, col_layout) }; |
| 1845 | } |
| 1846 | let mut elements = Vec::with_capacity(cols.len() as usize); |
| 1847 | for col in cols.iter() { |
| 1848 | let col = col.idx(); |
| 1849 | // SAFETY: caller promised that any `col` is in-bounds of `col_layouts`. |
| 1850 | let col_layout = unsafe { col_layouts.get_unchecked(col) }; |
| 1851 | // SAFETY: |
| 1852 | // - `col_layout` was just derived from the row layout. |
| 1853 | // - `AlgebraicValue` is compatible with any `col_layout`. |
| 1854 | // - `self` is a valid row and offsetting to `col_layout` is valid. |
| 1855 | elements.push(unsafe { AlgebraicValue::unchecked_read_column(self, col_layout) }); |
| 1856 | } |
| 1857 | AlgebraicValue::product(elements) |
| 1858 | } |
| 1859 | |
| 1860 | /// Construct a projection of the row at `self` by extracting the `cols`. |
| 1861 | /// |
no test coverage detected