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

Method unchecked_read_column

crates/table/src/read_column.rs:176–190  ·  view source on GitHub ↗
(row_ref: RowRef<'_>, layout: &ProductTypeElementLayout)

Source from the content-addressed store, hash-verified

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
193macro_rules! impl_read_column_number {

Callers

nothing calls this directly

Calls 11

PageOffsetClass · 0.85
SizeClass · 0.85
page_and_offsetMethod · 0.80
castMethod · 0.80
blob_storeMethod · 0.80
row_layoutMethod · 0.80
try_intoMethod · 0.80
serialize_valueFunction · 0.70
newFunction · 0.50
get_row_dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected