Skip to main content

ascending_range

Function ascending_range 

Source
pub fn ascending_range(anchor: usize, target: usize) -> Vec<usize>
Expand description

Build an ascending Vec<usize> spanning from anchor to target (inclusive), regardless of which is larger.

Used for range-selection in commit and file lists in both GUI and TUI.

§Examples

assert_eq!(gitkraft_core::ascending_range(3, 7), vec![3, 4, 5, 6, 7]);
assert_eq!(gitkraft_core::ascending_range(7, 3), vec![3, 4, 5, 6, 7]);
assert_eq!(gitkraft_core::ascending_range(5, 5), vec![5]);