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

Function read_from_bytes

crates/table/src/bflatn_from.rs:407–410  ·  view source on GitHub ↗

Read a `T` from `bytes` at the `curr_offset` and advance by `size` bytes. # Safety Let `value = &bytes[range_move(0..size_of:: (), *curr_offset)]`. Then `value` must point to a valid `T` and must be properly aligned for `T`.

(bytes: &Bytes, curr_offset: CurrOffset<'_>)

Source from the content-addressed store, hash-verified

405/// Let `value = &bytes[range_move(0..size_of::<T>(), *curr_offset)]`.
406/// Then `value` must point to a valid `T` and must be properly aligned for `T`.
407pub unsafe fn read_from_bytes<T: Copy>(bytes: &Bytes, curr_offset: CurrOffset<'_>) -> T {
408 // SAFETY: forward caller requirements.
409 update(curr_offset, |co| unsafe { row_hash::read_from_bytes(bytes, co) })
410}

Callers 1

serialize_valueFunction · 0.70

Calls 1

updateFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…