fork_map

Function fork_map 

Source
pub fn fork_map<M, Left, Right>(
    model: M,
    accum: &mut Vec<Left>,
    fork_fn: impl Fn(M::Arg) -> (Left, Right),
) -> M::Mapped<Right>
where M: Parametric,
Expand description

A low-level utility that maps a parametric structure while extracting a second set of values.

This function iterates through the model, applying fork_fn to each parameter. The fork_fn returns a tuple (Left, Right).

  • The Left value is collected into the accum vector.
  • The Right value is used to construct the new, mapped model structure.

It is an efficient building block for extract_map_defaults because it pre-allocates the accumulator Vec and fills it without intermediate allocations.