fn validify_u8_buffer<'a>(u8_slice: & [u8], dest_slice: &'a mut [u8]) -> &'a mut [u8] {
    let mut cur_slice = u8_slice;
    let mut output_len:usize = 0;
    while cur_slice.len() > 0 {
        match str::from_utf8(cur_slice) {
            Ok(str_ref) => {
                let ref_len = str_ref.len();
                copy_u8_slice_to_u8_slice(&cur_slice[0 .. ref_len], & mut dest_slice[output_len ..]);
                cur_slice = &cur_slice[ref_len ..];
                output_len += ref_len;
            }
            Err(en) => {
                let valid_up_to = en.valid_up_to();
                copy_u8_slice_to_u8_slice(&cur_slice[0 .. valid_up_to], &mut dest_slice[output_len ..]);
                cur_slice = & cur_slice[valid_up_to ..];
                output_len += valid_up_to;
                match en.error_len() {
                    Option::Some(err_len) => {
                        copy_replacement_to_u8_slice(& mut dest_slice[output_len ..]);
                        output_len += 3;
                        cur_slice = & cur_slice[err_len .. ];
                    }
                    Option::None => {
                        copy_replacement_to_u8_slice(& mut dest_slice[output_len ..]);
                        output_len += 3;
                        return & mut dest_slice[0 .. output_len]; // EOF
                    }
                }
            }
        }
    }
    & mut dest_slice[0 .. output_len]
}
// Calls str::from_utf8() to convert with replacement from one u8 buffer to another one.
Calls str::from_utf8() to convert with replacement from one u8 buffer to another one.
Calls str :: from_utf8 () to convert with replacement from one u8 buffer to another one .
fn validify_u8_buffer<'a>(u8_slice: & [u8], dest_slice: &'a mut [u8]) -> &'a mut [u8] {
    let mut cur_slice = u8_slice;
    let mut output_len:usize = 0;
    while cur_slice.len() > 0 {
        match str::from_utf8(cur_slice) {
            Ok(str_ref) => {
                let ref_len = str_ref.len();
                copy_u8_slice_to_u8_slice(&cur_slice[0 .. ref_len], & mut dest_slice[output_len ..]);
                cur_slice = &cur_slice[ref_len ..];
                output_len += ref_len;
            }
            Err(en) => {
                let valid_up_to = en.valid_up_to();
                copy_u8_slice_to_u8_slice(&cur_slice[0 .. valid_up_to], &mut dest_slice[output_len ..]);
                cur_slice = & cur_slice[valid_up_to ..];
                output_len += valid_up_to;
                match en.error_len() {
                    Option::Some(err_len) => {
                        copy_replacement_to_u8_slice(& mut dest_slice[output_len ..]);
                        output_len += 3;
                        cur_slice = & cur_slice[err_len .. ];
                    }
                    Option::None => {
                        copy_replacement_to_u8_slice(& mut dest_slice[output_len ..]);
                        output_len += 3;
                        return & mut dest_slice[0 .. output_len]; // EOF
                    }
                }
            }
        }
    }
    & mut dest_slice[0 .. output_len]
}
fn validify_u8_buffer < ' a > ( u8_slice : & [ u8 ] , dest_slice : & ' a mut [ u8 ] ) -> & ' a mut [ u8 ] { let mut cur_slice = u8_slice ; let mut output_len : usize = 0 ; while cur_slice . len ( ) > 0 { match str :: from_utf8 ( cur_slice ) { Ok ( str_ref ) => { let ref_len = str_ref . len ( ) ; copy_u8_slice_to_u8_slice ( & cur_slice [ 0 .. ref_len ] , & mut dest_slice [ output_len .. ] ) ; cur_slice = & cur_slice [ ref_len .. ] ; output_len += ref_len ; } Err ( en ) => { let valid_up_to = en . valid_up_to ( ) ; copy_u8_slice_to_u8_slice ( & cur_slice [ 0 .. valid_up_to ] , & mut dest_slice [ output_len .. ] ) ; cur_slice = & cur_slice [ valid_up_to .. ] ; output_len += valid_up_to ; match en . error_len ( ) { Option :: Some ( err_len ) => { copy_replacement_to_u8_slice ( & mut dest_slice [ output_len .. ] ) ; output_len += 3 ; cur_slice = & cur_slice [ err_len .. ] ; } Option :: None => { copy_replacement_to_u8_slice ( & mut dest_slice [ output_len .. ] ) ; output_len += 3 ; return & mut dest_slice [ 0 .. output_len ] ; // EOF } } } } } & mut dest_slice [ 0 .. output_len ] }
Calls str::from_utf8() to convert with replacement from one u8 buffer to another one.
Calls str :: from_utf8 () to convert with replacement from one u8 buffer to another one .
u8_slice
& [u8]
dest_slice
&'a mut [u8]
u8_slice
& [u8]
dest_slice
&'a mut [u8]