Skip to main content

with_possible_relaxation

Function with_possible_relaxation 

Source
fn with_possible_relaxation<'a, SEL, OK, T>(
    selector: &'a RelaySelector<'_>,
    select: SEL,
    ok: OK,
) -> (T, SelectionInfo<'a>)
where SEL: FnMut(&RelaySelector<'_>) -> (T, FilterCounts), OK: Fn(&T) -> bool,
Expand description

Re-run relay selection, relaxing our selector as necessary.

This is a helper to implement our relay selection logic. We try to run select to find one or more random relays conforming to selector. If ok says that the result is good (by returning true), we return that result. Otherwise, we try to relax the selector (if possible), and try again. If the selector can’t be relaxed any further, we return the original (not-ok) result.