fn utf32_to_utf8_multi_buffer_slice_reading() {
    let mybuffers = [[0x7Fu32, 0x80u32], [0x81u32, 0x82u32]];
    let mut parser = FromUnicode::new();
    for indx in 0 .. mybuffers.len() {
        parser.set_is_last_buffer(indx == mybuffers.len() - 1);
        let current_array = mybuffers[indx];
        let mut current_slice = & current_array[..];
        loop {
            match parser.utf32_to_utf8(current_slice) {
                Result::Ok((slice_pos, utf8_val)) => {
                    current_slice = slice_pos;
                    println!("{:02x}", utf8_val);
                    println!("{}", parser.has_invalid_sequence());
                }
                Result::Err(MoreEnum::More(_amt)) => {
                    // _amt equals to 0 when end of data
                    break;
                }
            }
        }
    }
}
/// Multi-buffer slice reading based UTF32 parsing converting to UTF8
Multi-buffer slice reading based UTF32 parsing converting to UTF8
Multi - buffer slice reading based UTF32 parsing converting to UTF8
fn utf32_to_utf8_multi_buffer_slice_reading() {
    let mybuffers = [[0x7Fu32, 0x80u32], [0x81u32, 0x82u32]];
    let mut parser = FromUnicode::new();
    for indx in 0 .. mybuffers.len() {
        parser.set_is_last_buffer(indx == mybuffers.len() - 1);
        let current_array = mybuffers[indx];
        let mut current_slice = & current_array[..];
        loop {
            match parser.utf32_to_utf8(current_slice) {
                Result::Ok((slice_pos, utf8_val)) => {
                    current_slice = slice_pos;
                    println!("{:02x}", utf8_val);
                    println!("{}", parser.has_invalid_sequence());
                }
                Result::Err(MoreEnum::More(_amt)) => {
                    // _amt equals to 0 when end of data
                    break;
                }
            }
        }
    }
}
fn utf32_to_utf8_multi_buffer_slice_reading ( ) { let mybuffers = [ [ 0x7Fu32 , 0x80u32 ] , [ 0x81u32 , 0x82u32 ] ] ; let mut parser = FromUnicode :: new ( ) ; for indx in 0 .. mybuffers . len ( ) { parser . set_is_last_buffer ( indx == mybuffers . len ( ) - 1 ) ; let current_array = mybuffers [ indx ] ; let mut current_slice = & current_array [ .. ] ; loop { match parser . utf32_to_utf8 ( current_slice ) { Result :: Ok ( ( slice_pos , utf8_val ) ) => { current_slice = slice_pos ; println ! ( " " utf8_val ) ; println ! ( " " parser has_invalid_sequence ( ) ) ; } Result :: Err ( MoreEnum :: More ( _amt ) ) => { // _amt equals to 0 when end of data break ; } } } } }
Multi-buffer slice reading based UTF32 parsing converting to UTF8
Multi - buffer slice reading based UTF32 parsing converting to UTF8