Skip to main content

render_explain

Function render_explain 

Source
pub fn render_explain(layout: &StructLayout) -> String
Expand description

Render a visual layout table for one struct.

Example output:

ReadyEvent  24 bytes  align=4
┌──────────────────────────────────────────────────────────────────┐
│ offset │ size │ align │ CL │ field                              │
├──────────────────────────────────────────────────────────────────┤
│      0 │    1 │     1 │  0 │ tick: u8                          │
│      1 │    3 │     — │  0 │ <padding>                         │
│      4 │    4 │     4 │  0 │ ready: Ready                      │
│      8 │    1 │     1 │  0 │ is_shutdown: bool                 │
│      9 │   15 │     — │  0 │ <padding> (trailing)              │
└──────────────────────────────────────────────────────────────────┘
14 bytes wasted (58%) — reorder: ready, tick, is_shutdown → 8 bytes

The CL column shows the zero-indexed cache-line number for each field. A cache-line separator row (╞══ cache line N ══╡) is also emitted whenever the layout crosses a cache-line boundary.