fn null_terminator_index(slice: &[u8]) -> usize {
    slice
        .iter()
        .rposition(|&b| b != b'\0')
        .map_or(0, |idx| idx + 1)
}
/// Find the position of the first null-terminator (\b'0') in a u8 slice,
/// or return 0 if they're all null-terminators.
/// This function is roughly equivalent to libc strlen.
Find the position of the first null-terminator (\b'0') in a u8 slice,
or return 0 if they're all null-terminators.
This function is roughly equivalent to libc strlen.
Find the position of the first null - terminator ( \ b ' 0 ' ) in a u8 slice or return 0 if they ' re all null - terminators . This function is roughly equivalent to libc strlen .
fn null_terminator_index(slice: &[u8]) -> usize {
    slice
        .iter()
        .rposition(|&b| b != b'\0')
        .map_or(0, |idx| idx + 1)
}
fn null_terminator_index ( slice : & [ u8 ] ) -> usize { slice . iter ( ) . rposition ( | & b | b != b'\0' ) . map_or ( 0 , | idx | idx + 1 ) }
Find the position of the first null-terminator (\b'0') in a u8 slice,
or return 0 if they're all null-terminators.
Find the position of the first null - terminator ( \ b ' 0 ' ) in a u8 slice or return 0 if they ' re all null - terminators .
slice
&[u8]
slice
&[u8]