Skip to main content

validate_topo_sort

Function validate_topo_sort 

Source
pub fn validate_topo_sort<Id, PredsIter>(
    topo_sort: impl IntoIterator<Item = Id>,
    preds_fn: impl FnMut(Id) -> PredsIter,
) -> Result<(), (Id, Id)>
where Id: Copy + Eq + Ord, PredsIter: IntoIterator<Item = Id>,
Expand description

Validates the topo sort.

Returns Ok(()) if it is valid. Returns Err((pred, succ)) where pred comes after succ when the sort is invalid. Panics if a node returned by the pred_fn is missing from the sort.