MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / eq

Method eq

crates/table/src/table.rs:2036–2053  ·  view source on GitHub ↗
(&self, other: &Self)

Source from the content-addressed store, hash-verified

2034impl Eq for RowRef<'_> {}
2035impl 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
2056impl PartialEq<ProductValue> for RowRef<'_> {

Callers

nothing calls this directly

Calls 6

eqFunction · 0.85
eq_row_in_pageFunction · 0.85
eq_row_in_page_to_pvFunction · 0.85
row_layoutMethod · 0.80
page_and_offsetMethod · 0.80
static_layoutMethod · 0.80

Tested by

no test coverage detected