Skip to main content

debug_assert_aligned_offset

Function debug_assert_aligned_offset 

Source
pub fn debug_assert_aligned_offset(off: u64)
Expand description

Debug-only file-offset alignment assertion that is safe to export.

Same rationale as debug_assert_aligned: keep a stable symbol that callers can invoke without cfg fences, while ensuring zero cost in release/bench builds.

Why not a module-level cfg or use:

  • Some bench setups compile with --all-features and may still pull modules in ways that trip cfg-ed imports. Gating inside the body avoids those hazards and keeps the bench linker happy.

Behavior:

  • Debug/test: checks that off is a multiple of the configured PAYLOAD_ALIGNMENT.
  • Release/bench: no-op, arguments are marked used.

Notes:

  • This asserts the derived start offset of a payload, not the pointer. Use the pointer variant to assert the actual address you hand to consumers like Arrow.