Parse "HH:MM" to hour.
(s: &str)
| 249 | |
| 250 | /// Parse "HH:MM" to hour. |
| 251 | fn parse_hour(s: &str) -> u8 { |
| 252 | s.split(':') |
| 253 | .next() |
| 254 | .and_then(|h| h.parse::<u8>().ok()) |
| 255 | .unwrap_or(0) |
| 256 | } |
| 257 | |
| 258 | #[cfg(test)] |
| 259 | mod tests { |
no test coverage detected