pub(super) fn level0(
        candidate: &'a C::Hash,
        state: &'a State<C>,
        latest: &'a ValidatorMap<Option<&'a C::Hash>>,
    ) -> Self {
        let height = state.block(candidate).height;
        let to_lvl0unit = |&maybe_vhash: &Option<&'a C::Hash>| {
            state
                .swimlane(maybe_vhash?)
                .take_while(|(_, unit)| {
                    state.find_ancestor_proposal(&unit.block, height) == Some(candidate)
                })
                .last()
                .map(|(_, unit)| unit.seq_number)
        };
        Horizon {
            sequence_numbers: latest.iter().map(to_lvl0unit).collect(),
            state,
            latest,
        }
    }
/// Creates a horizon assigning to each validator their level-0 unit, i.e. the oldest unit in
/// their current streak of units for `candidate` (and descendants), or `None` if their latest
/// unit is not for `candidate`.
Creates a horizon assigning to each validator their level-0 unit, i.e.
Creates a horizon assigning to each validator their level - 0 unit i . e .
pub(super) fn level0(
        candidate: &'a C::Hash,
        state: &'a State<C>,
        latest: &'a ValidatorMap<Option<&'a C::Hash>>,
    ) -> Self {
        let height = state.block(candidate).height;
        let to_lvl0unit = |&maybe_vhash: &Option<&'a C::Hash>| {
            state
                .swimlane(maybe_vhash?)
                .take_while(|(_, unit)| {
                    state.find_ancestor_proposal(&unit.block, height) == Some(candidate)
                })
                .last()
                .map(|(_, unit)| unit.seq_number)
        };
        Horizon {
            sequence_numbers: latest.iter().map(to_lvl0unit).collect(),
            state,
            latest,
        }
    }
pub ( super ) fn level0 ( candidate : & ' a C :: Hash , state : & ' a State < C > , latest : & ' a ValidatorMap < Option < & ' a C :: Hash > > , ) -> Self { let height = state . block ( candidate ) . height ; let to_lvl0unit = | & maybe_vhash : & Option < & ' a C :: Hash > | { state . swimlane ( maybe_vhash ? ) . take_while ( | ( _ , unit ) | { state . find_ancestor_proposal ( & unit . block , height ) == Some ( candidate ) } ) . last ( ) . map ( | ( _ , unit ) | unit . seq_number ) } ; Horizon { sequence_numbers : latest . iter ( ) . map ( to_lvl0unit ) . collect ( ) , state , latest , } }
Creates a horizon assigning to each validator their level-0 unit, i.e.
Creates a horizon assigning to each validator their level - 0 unit i . e .
candidate
&'a C::Hash
state
&'a State<C>
latest
&'a ValidatorMap<Option<&'a C::Hash>>
candidate
&'a C::Hash
state
&'a State<C>
latest
&'a ValidatorMap<Option<&'a C::Hash>>