fn resolve_index(
    from: usize,
    cycles: bool,
    direction: ScopeDirection,
    max_value: usize,
) -> Option<usize> {
    use ScopeDirection::*;
    match (direction, cycles, from) {
        (Previous, true, 0) => Some(max_value),
        (Previous, true, from) => Some(from - 1),
        (Previous, false, 0) => None,
        (Previous, false, from) => Some(from - 1),
        (Next, true, from) => Some((from + 1) % (max_value + 1)),
        (Next, false, from) if from == max_value => None,
        (Next, false, from) => Some(from + 1),
    }
}
/// Cycle through a [scoped menu](MenuSetting::CycleScope) according to menu settings
///
/// Returns the index of the element to focus according to `direction`. Cycles
/// if `cycles` and goes over `max_value` or goes bellow 0. `None` if the
/// direction is a dead end.
Cycle through a [scoped menu](MenuSetting::CycleScope) according to menu settings
Returns the index of the element to focus according to `direction`. Cycles
if `cycles` and goes over `max_value` or goes bellow 0. `None` if the
direction is a dead end.
Cycle through a [ scoped menu ] ( MenuSetting :: CycleScope ) according to menu settings Returns the index of the element to focus according to ` direction ` . Cycles if ` cycles ` and goes over ` max_value ` or goes bellow 0 . ` None ` if the direction is a dead end .
fn resolve_index(
    from: usize,
    cycles: bool,
    direction: ScopeDirection,
    max_value: usize,
) -> Option<usize> {
    use ScopeDirection::*;
    match (direction, cycles, from) {
        (Previous, true, 0) => Some(max_value),
        (Previous, true, from) => Some(from - 1),
        (Previous, false, 0) => None,
        (Previous, false, from) => Some(from - 1),
        (Next, true, from) => Some((from + 1) % (max_value + 1)),
        (Next, false, from) if from == max_value => None,
        (Next, false, from) => Some(from + 1),
    }
}
fn resolve_index ( from : usize , cycles : bool , direction : ScopeDirection , max_value : usize , ) -> Option < usize > { use ScopeDirection :: * ; match ( direction , cycles , from ) { ( Previous , true , 0 ) => Some ( max_value ) , ( Previous , true , from ) => Some ( from - 1 ) , ( Previous , false , 0 ) => None , ( Previous , false , from ) => Some ( from - 1 ) , ( Next , true , from ) => Some ( ( from + 1 ) % ( max_value + 1 ) ) , ( Next , false , from ) if from == max_value => None , ( Next , false , from ) => Some ( from + 1 ) , } }
Cycle through a [scoped menu](MenuSetting::CycleScope) according to menu settings
Returns the index of the element to focus according to `direction`.
Cycle through a [ scoped menu ] ( MenuSetting :: CycleScope ) according to menu settings Returns the index of the element to focus according to ` direction ` .
from
usize
cycles
bool
direction
ScopeDirection
max_value
usize
from
usize
cycles
bool
direction
ScopeDirection
max_value
usize