[pointer] Add generic projection/cast framework by joshlf · Pull Request #2860 · google/zerocopy

@joshlf mentioned this pull request

Dec 23, 2025

gemini-code-assist[bot]

gemini-code-assist[bot]

joshlf

jswrenn

jswrenn

This was referenced

Dec 30, 2025

gemini-code-assist[bot]

gemini-code-assist[bot]

This was referenced

Jan 2, 2026

jswrenn

@joshlf

Add `unsafe trait Project` and `unsafe trait Cast: Project`. `Cast` is
implemented for any address-preserving cast, while `Project` generalizes
to conversions which may not preserve the address of the referent (ie,
field projections). Use these (mostly `Cast`, but some `Project`) to
unify `PtrInner`/`Ptr` casts, field projections, and `SizeEq` casts.
Replace a good amount of unsafe derive-generated code with uses of this
machinery.

Makes progress on #196
Closes #2856

gherrit-pr-id: Gdeb4f5a282b778a82175703218739a93074d0cc4

@joshlf joshlf deleted the Gdeb4f5a282b778a82175703218739a93074d0cc4 branch

January 6, 2026 17:28