Currently, the fields of range are not public.
Additionally, I am not sure how to implement .inclusive() exactly correctly without a performance hit. I believe that even a slight performance hit on range (say, 1 additional instruction per iteration) would have a measurable effect due to the fact that some programs spend most of their time looping in ranges.
Examples of hard-to-handle code:
let mut x = 0_u8..1_u8;
let _ = x.next();
let _ = x.next();
let mut y = x.inclusive();
println!("{:?}", y.next());
- This should also output
None:
let mut x = 0_u8..1_u8;
for _ in 0_i32..256_i32 {
let _ = x.next();
}
let mut y = x.inclusive();
println!("{:?}", y.next());