pub fn resolve_page_reference_fixpoint<T>(
document: &mut Document,
layout: impl FnMut(&Document) -> (BTreeMap<String, u32>, T),
max_iterations: u32,
) -> (PageFixpointOutcome, T)Expand description
Drive page-reference resolution to a fixpoint against an injected layout.
layout lays document out and returns its label→page map plus the full
layout artifact T, so the caller keeps the final artifact without an extra
pass. Each round resolves page references from the previous map, then
re-lays-out; it converges when the map stops changing. Oscillation (a
previously-seen map recurs) and exhausting max_iterations both yield
NotConverged with the most recent
artifact.
Layout is a parameter rather than a direct call so mos-eval does not depend
on mos-layout and the convergence logic can be tested with a mock.