Coverage Report

Created: 2025-11-16 07:04

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/rust/registry/src/index.crates.io-1949cf8c6b5b557f/fixedbitset-0.5.7/src/range.rs
Line
Count
Source
1
use core::ops::{Range, RangeFrom, RangeFull, RangeTo};
2
3
// Taken from https://github.com/bluss/odds/blob/master/src/range.rs.
4
5
/// **IndexRange** is implemented by Rust's built-in range types, produced
6
/// by range syntax like `..`, `a..`, `..b` or `c..d`.
7
pub trait IndexRange<T = usize> {
8
    #[inline]
9
    /// Start index (inclusive)
10
0
    fn start(&self) -> Option<T> {
11
0
        None
12
0
    }
13
    #[inline]
14
    /// End index (exclusive)
15
0
    fn end(&self) -> Option<T> {
16
0
        None
17
0
    }
18
}
19
20
impl<T> IndexRange<T> for RangeFull {}
21
22
impl<T: Copy> IndexRange<T> for RangeFrom<T> {
23
    #[inline]
24
0
    fn start(&self) -> Option<T> {
25
0
        Some(self.start)
26
0
    }
27
}
28
29
impl<T: Copy> IndexRange<T> for RangeTo<T> {
30
    #[inline]
31
0
    fn end(&self) -> Option<T> {
32
0
        Some(self.end)
33
0
    }
34
}
35
36
impl<T: Copy> IndexRange<T> for Range<T> {
37
    #[inline]
38
0
    fn start(&self) -> Option<T> {
39
0
        Some(self.start)
40
0
    }
41
    #[inline]
42
0
    fn end(&self) -> Option<T> {
43
0
        Some(self.end)
44
0
    }
45
}