fn find_leaf_split(s: &str, minsplit: usize) -> usize {
    let mut splitpoint = min(MAX_LEAF, s.len() - MIN_LEAF);
    match memrchr(b'\n', &s.as_bytes()[minsplit - 1..splitpoint]) {
        Some(pos) => minsplit + pos,
        None => {
            while !s.is_char_boundary(splitpoint) {
                splitpoint -= 1;
            }
            splitpoint
        }
    }
}
// Try to split at newline boundary (leaning left), if not, then split at codepoint
Try to split at newline boundary (leaning left), if not, then split at codepoint
Try to split at newline boundary ( leaning left ) if not then split at codepoint
fn find_leaf_split(s: &str, minsplit: usize) -> usize {
    let mut splitpoint = min(MAX_LEAF, s.len() - MIN_LEAF);
    match memrchr(b'\n', &s.as_bytes()[minsplit - 1..splitpoint]) {
        Some(pos) => minsplit + pos,
        None => {
            while !s.is_char_boundary(splitpoint) {
                splitpoint -= 1;
            }
            splitpoint
        }
    }
}
fn find_leaf_split ( s : & str , minsplit : usize ) -> usize { let mut splitpoint = min ( MAX_LEAF , s . len ( ) - MIN_LEAF ) ; match memrchr ( b'\n' , & s . as_bytes ( ) [ minsplit - 1 .. splitpoint ] ) { Some ( pos ) => minsplit + pos , None => { while ! s . is_char_boundary ( splitpoint ) { splitpoint -= 1 ; } splitpoint } } }
Try to split at newline boundary (leaning left), if not, then split at codepoint
Try to split at newline boundary ( leaning left ) if not then split at codepoint
s
&str
minsplit
usize