(row_ref: RowRef<'_>, layout: &ProductTypeElementLayout)
| 174 | } |
| 175 | |
| 176 | unsafe fn unchecked_read_column(row_ref: RowRef<'_>, layout: &ProductTypeElementLayout) -> Self { |
| 177 | debug_assert!(Self::is_compatible_type(&layout.ty)); |
| 178 | |
| 179 | let (page, offset) = row_ref.page_and_offset(); |
| 180 | let col_offset = offset + PageOffset(layout.offset); |
| 181 | |
| 182 | let data = page.get_row_data(col_offset, Size(mem::size_of::<Self>() as u16)); |
| 183 | let data: *const bool = data.as_ptr().cast(); |
| 184 | // SAFETY: We trust that the `row_ref` refers to a valid, initialized row, |
| 185 | // and that the `offset_in_bytes` refers to a column of type `Bool` within that row. |
| 186 | // A valid row can never have a column of an invalid value, |
| 187 | // and no byte in `Page.row_data` is ever uninit, |
| 188 | // so `data` must be initialized as either 0 or 1. |
| 189 | unsafe { *data } |
| 190 | } |
| 191 | } |
| 192 | |
| 193 | macro_rules! impl_read_column_number { |
nothing calls this directly
no test coverage detected