Guide API
Skip to main content

solve

Function solve 

Source
pub fn solve(slots: &[Slot], total: i32) -> Vec<i32>
Expand description

Apportion total cells across slots, honoring each [min, max] and distributing the remaining free space by weight. Deterministic (largest-remainder rounding); the returned sizes always sum to total.max(sum_of_mins-clamped) and never violate a slot’s bounds.

total here is the content length (axis length already minus the dividers’ reserved cells — the caller subtracts those).