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

Function assert_alignment

crates/table/src/page.rs:1033–1042  ·  view source on GitHub ↗

Assert that `ptr` is sufficiently aligned to reference a value of `T`. In release mode, this is a no-op.

(ptr: *const Byte)

Source from the content-addressed store, hash-verified

1031///
1032/// In release mode, this is a no-op.
1033fn assert_alignment<T>(ptr: *const Byte) {
1034 debug_assert_eq!(
1035 ptr as usize % mem::align_of::<T>(),
1036 0,
1037 "Wanted a PageOffset with align 0x{:x} (for {}) but found 0x{:x}",
1038 mem::align_of::<T>(),
1039 std::any::type_name::<T>(),
1040 ptr as usize,
1041 );
1042}
1043
1044/// Returns a reference to the [`T`] pointed to at by `offset`.
1045///

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…