/// Creates a `Layout` where every course is exactly one lead long.
Creates a `Layout` where every course is exactly one lead long.
Creates a ` Layout ` where every course is exactly one lead long .
pub fn leadwise(
    methods: &[super::Method],
    calls: &CallVec<super::Call>,
    splice_style: SpliceStyle,
) -> Result<Layout> {
    super::utils::check_duplicate_shorthands(methods)?;
    let stage = methods
        .iter()
        .map(|m| m.stage())
        .max()
        .expect("Can't compute stage of 0 methods");
    let method_blocks = methods
        .iter()
        .map(|m| MethodBlock {
            block: m
                .first_lead()
                .clone_map_annots_with_index(|i, _| (i == 0).then(|| m.shorthand.clone())),
            count_range: m.count_range.clone(),
        })
        .collect::<BlockVec<_>>();
    let fixed_bells = super::utils::fixed_bells(methods, calls, stage);
    let lead_head_mask = Mask::fix_bells(stage, fixed_bells);
    Ok(Layout {
        starts: start_or_ends(&lead_head_mask, methods, Boundary::Start),
        ends: start_or_ends(&lead_head_mask, methods, Boundary::End),
        links: links(methods, calls, &lead_head_mask, splice_style),
        method_blocks,
        stage,
        leadwise: true,
    })
}
pub fn leadwise ( methods : & [ super :: Method ] , calls : & CallVec < super :: Call > , splice_style : SpliceStyle , ) -> Result < Layout > { super :: utils :: check_duplicate_shorthands ( methods ) ? ; let stage = methods . iter ( ) . map ( | m | m . stage ( ) ) . max ( ) . expect ( " " ) ; let method_blocks = methods . iter ( ) . map ( | m | MethodBlock { block : m . first_lead ( ) . clone_map_annots_with_index ( | i , _ | ( i == 0 ) . then ( | | m . shorthand . clone ( ) ) ) , count_range : m . count_range . clone ( ) , } ) . collect :: < BlockVec < _ > > ( ) ; let fixed_bells = super :: utils :: fixed_bells ( methods , calls , stage ) ; let lead_head_mask = Mask :: fix_bells ( stage , fixed_bells ) ; Ok ( Layout { starts : start_or_ends ( & lead_head_mask , methods , Boundary :: Start ) , ends : start_or_ends ( & lead_head_mask , methods , Boundary :: End ) , links : links ( methods , calls , & lead_head_mask , splice_style ) , method_blocks , stage , leadwise : true , } ) }
Creates a `Layout` where every course is exactly one lead long.
Creates a ` Layout ` where every course is exactly one lead long .
methods
&[super::Method]
calls
&CallVec<super::Call>
splice_style
SpliceStyle