gen_layout_ctx_expr

Function gen_layout_ctx_expr 

Source
pub(crate) fn gen_layout_ctx_expr(
    ty: &Type,
    is_manual_slot: bool,
    slot_const_ref: TokenStream,
    offset_const_ref: TokenStream,
    prev_slot_const_ref: Option<TokenStream>,
    next_slot_const_ref: Option<TokenStream>,
) -> TokenStream
Expand description

Generate a LayoutCtx expression for accessing a field.

This helper unifies the logic for choosing between LayoutCtx::FULL and LayoutCtx::packed based on compile-time slot comparison with neighboring fields.

A field uses Packed if it shares a slot with any neighboring field.