pub fn enum_layout(
cases: &[(Arc<str>, Vec<LayoutId>)],
layouts: &[Layout],
) -> (Vec<Case>, Vec<Repr>)Expand description
Lays out an enum’s payload region, answering the cases and the region’s words.
The one constraint is that every case that uses a payload word agrees on
that word’s Repr, because one static reference map has to be right
whatever case a value holds. Each case’s parts are placed greedily into
the lowest run of payload words that is free for this case and either
unassigned or already assigned the same Reprs.
A region can therefore be wider than the widest case — A(Int, String)
and B(Float) need four words between them, not three. That is the price
of a map a collection can read without asking which case a value is in.