(s: &str, d: usize)
| 20 | /// return d-th character of s, -1 if d = length of string |
| 21 | #[inline(always)] |
| 22 | pub fn byte_at_checked(s: &str, d: usize) -> i32 { |
| 23 | if let Some(v) = s.as_bytes().get(d) { |
| 24 | *v as i32 |
| 25 | } else { |
| 26 | -1 |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | /// uncheck version of byte_at |
| 31 | #[inline(always)] |