MCPcopy Create free account
hub / github.com/douchuan/algorithm / byte_at_checked

Function byte_at_checked

src/common/util.rs:22–28  ·  view source on GitHub ↗
(s: &str, d: usize)

Source from the content-addressed store, hash-verified

20/// return d-th character of s, -1 if d = length of string
21#[inline(always)]
22pub 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)]

Callers 2

do_sortMethod · 0.85
do_sortMethod · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected