(&self, other: &Self)
| 2034 | impl Eq for RowRef<'_> {} |
| 2035 | impl PartialEq for RowRef<'_> { |
| 2036 | fn eq(&self, other: &Self) -> bool { |
| 2037 | // Ensure that the layouts are the same |
| 2038 | // so that we can use `eq_row_in_page`. |
| 2039 | // To do this, we first try address equality on the layouts. |
| 2040 | // This should succeed when the rows originate from the same table. |
| 2041 | // Otherwise, actually compare the layouts, which is expensive, but unlikely to happen. |
| 2042 | let a_ty = self.row_layout(); |
| 2043 | let b_ty = other.row_layout(); |
| 2044 | if !(ptr::eq(a_ty, b_ty) || a_ty == b_ty) { |
| 2045 | return false; |
| 2046 | } |
| 2047 | let (page_a, offset_a) = self.page_and_offset(); |
| 2048 | let (page_b, offset_b) = other.page_and_offset(); |
| 2049 | let static_layout = self.static_layout(); |
| 2050 | // SAFETY: `offset_a/b` are valid rows in `page_a/b` typed at `a_ty` |
| 2051 | // and `static_bsatn_layout` is derived from `a_ty`. |
| 2052 | unsafe { eq_row_in_page(page_a, page_b, offset_a, offset_b, a_ty, static_layout) } |
| 2053 | } |
| 2054 | } |
| 2055 | |
| 2056 | impl PartialEq<ProductValue> for RowRef<'_> { |
nothing calls this directly
no test coverage detected