MCPcopy Create free account
hub / github.com/Apress/beginning-rust-2e / get_third

Function get_third

Source Code/19-31.rs:4–10  ·  view source on GitHub ↗
(r: std::ops::Range<u32>)

Source from the content-addressed store, hash-verified

2None, Some(22)*/
3fn main() {
4 fn get_third(r: std::ops::Range<u32>) -> Option<u32> {
5 if r.len() >= 3 {
6 Some(r.start + 2)
7 } else {
8 None
9 }
10 }
11 print!("{:?}, {:?}", get_third(10..12), get_third(20..29));
12}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected