MCPcopy Create free account
hub / github.com/DioxusLabs/dioxus-components / default_range_extractor

Function default_range_extractor

primitives/src/virtual/utils.rs:18–31  ·  view source on GitHub ↗

Extract indices from a range with overscan applied.

(
    range: std::ops::Range<usize>,
    overscan: usize,
    count: usize,
)

Source from the content-addressed store, hash-verified

16
17/// Extract indices from a range with overscan applied.
18pub(crate) fn default_range_extractor(
19 range: std::ops::Range<usize>,
20 overscan: usize,
21 count: usize,
22) -> RangeInclusive<usize> {
23 if count == 0 {
24 return 0..=0;
25 }
26
27 let start = range.start.saturating_sub(overscan);
28 let end = (range.end + overscan).min(count - 1);
29
30 start..=end
31}

Callers 1

get_virtual_itemsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected