pub(crate) fn prefix_is_substring(
        reverse: bool,
        bs: &[u8],
        mut search: impl FnMut(&[u8], &[u8]) -> Option<usize>,
    ) -> bool {
        if bs.is_empty() {
            return true;
        }
        for i in 0..(bs.len() - 1) {
            let prefix = &bs[..i];
            if reverse {
                assert_eq!(naive_rfind(bs, prefix), search(bs, prefix));
            } else {
                assert_eq!(naive_find(bs, prefix), search(bs, prefix));
            }
        }
        true
    }
/// Check that every prefix of the given byte string is a substring.
Check that every prefix of the given byte string is a substring.
Check that every prefix of the given byte string is a substring .
pub(crate) fn prefix_is_substring(
        reverse: bool,
        bs: &[u8],
        mut search: impl FnMut(&[u8], &[u8]) -> Option<usize>,
    ) -> bool {
        if bs.is_empty() {
            return true;
        }
        for i in 0..(bs.len() - 1) {
            let prefix = &bs[..i];
            if reverse {
                assert_eq!(naive_rfind(bs, prefix), search(bs, prefix));
            } else {
                assert_eq!(naive_find(bs, prefix), search(bs, prefix));
            }
        }
        true
    }
pub ( crate ) fn prefix_is_substring ( reverse : bool , bs : & [ u8 ] , mut search : impl FnMut ( & [ u8 ] , & [ u8 ] ) -> Option < usize > , ) -> bool { if bs . is_empty ( ) { return true ; } for i in 0 .. ( bs . len ( ) - 1 ) { let prefix = & bs [ .. i ] ; if reverse { assert_eq ! ( naive_rfind ( bs prefix ) search ( bs prefix ) ) ; } else { assert_eq ! ( naive_find ( bs prefix ) search ( bs prefix ) ) ; } } true }
Check that every prefix of the given byte string is a substring.
Check that every prefix of the given byte string is a substring .
reverse
bool
bs
&[u8]
search
impl FnMut(&[u8], &[u8]) -> Option<usize>
reverse
bool
bs
&[u8]
search
impl FnMut(&[u8], &[u8]) -> Option<usize>