pub fn utf32_to_utf8<'c>(&mut self, input: &'c [u32])
    -> Result<(&'c [u32], u8), MoreEnum> {
        // Check if we can pull an u8 from our ring buffer
        match self.my_buf.pop_front() {
            Some(v1) => {
                return Result::Ok((input, v1));
            }
            None => {}
        }
        let mut my_cursor: &[u32] = input;
        // Processing for input being empty case
        if my_cursor.len() == 0 {
            // Determine if we are at end of data.
            if self.is_last_buffer() {
                // at end of data condition
                return Result::Err(MoreEnum::More(0));
            }
            else {
                // Returning an indication to request a new buffer.
                return Result::Err(MoreEnum::More(1024));
            }
        }
        // Grab one UTF32 from input
        let cur_u32 = my_cursor[0];
        my_cursor = &my_cursor[1..];
        // Try to determine the type of UTF32 encoding.
        match classify_utf32(cur_u32) {
            Utf8TypeEnum::Type1(v1) => {
                Result::Ok((my_cursor, v1))
            }
            Utf8TypeEnum::Type2((v1,v2)) => {
                self.my_buf.push_back(v2);
                Result::Ok((my_cursor, v1))
            }
            Utf8TypeEnum::Type3((v1,v2,v3)) => {
                self.my_buf.push_back(v2);
                self.my_buf.push_back(v3);
                Result::Ok((my_cursor, v1))
            }
            Utf8TypeEnum::Type4((v1,v2,v3,v4)) => {
                self.my_buf.push_back(v2);
                self.my_buf.push_back(v3);
                self.my_buf.push_back(v4);
                Result::Ok((my_cursor, v1))
            }
            _ => {
                // Invalid UTF32 codepoint
                // Emit replacement byte sequence.
                self.signal_invalid_sequence();
                self.my_buf.push_back(REPLACE_PART2);
                self.my_buf.push_back(REPLACE_PART3);
                Result::Ok((my_cursor, REPLACE_PART1))
            }
        }
    }
/// A parser takes in UTF32 slice, and returns a Result object with
/// either the remaining input and the output byte value, or an MoreEnum
/// that requests additional data, or an end of data stream condition.
///
/// Invalid UTF32 decodes are indicated by Unicode replacement characters.
/// has_invalid_decodes() would return true after this event.
/// Encountering a replacement character is considered the same as having
/// an invalid decode.

A parser takes in UTF32 slice, and returns a Result object with
either the remaining input and the output byte value, or an MoreEnum
that requests additional data, or an end of data stream condition.

Invalid UTF32 decodes are indicated by Unicode replacement characters.
has_invalid_decodes() would return true after this event.
Encountering a replacement character is considered the same as having
an invalid decode.
A parser takes in UTF32 slice and returns a Result object with either the remaining input and the output byte value or an MoreEnum that requests additional data or an end of data stream condition . Invalid UTF32 decodes are indicated by Unicode replacement characters . has_invalid_decodes () would return true after this event . Encountering a replacement character is considered the same as having an invalid decode .
pub fn utf32_to_utf8<'c>(&mut self, input: &'c [u32])
    -> Result<(&'c [u32], u8), MoreEnum> {
        // Check if we can pull an u8 from our ring buffer
        match self.my_buf.pop_front() {
            Some(v1) => {
                return Result::Ok((input, v1));
            }
            None => {}
        }
        let mut my_cursor: &[u32] = input;
        // Processing for input being empty case
        if my_cursor.len() == 0 {
            // Determine if we are at end of data.
            if self.is_last_buffer() {
                // at end of data condition
                return Result::Err(MoreEnum::More(0));
            }
            else {
                // Returning an indication to request a new buffer.
                return Result::Err(MoreEnum::More(1024));
            }
        }
        // Grab one UTF32 from input
        let cur_u32 = my_cursor[0];
        my_cursor = &my_cursor[1..];
        // Try to determine the type of UTF32 encoding.
        match classify_utf32(cur_u32) {
            Utf8TypeEnum::Type1(v1) => {
                Result::Ok((my_cursor, v1))
            }
            Utf8TypeEnum::Type2((v1,v2)) => {
                self.my_buf.push_back(v2);
                Result::Ok((my_cursor, v1))
            }
            Utf8TypeEnum::Type3((v1,v2,v3)) => {
                self.my_buf.push_back(v2);
                self.my_buf.push_back(v3);
                Result::Ok((my_cursor, v1))
            }
            Utf8TypeEnum::Type4((v1,v2,v3,v4)) => {
                self.my_buf.push_back(v2);
                self.my_buf.push_back(v3);
                self.my_buf.push_back(v4);
                Result::Ok((my_cursor, v1))
            }
            _ => {
                // Invalid UTF32 codepoint
                // Emit replacement byte sequence.
                self.signal_invalid_sequence();
                self.my_buf.push_back(REPLACE_PART2);
                self.my_buf.push_back(REPLACE_PART3);
                Result::Ok((my_cursor, REPLACE_PART1))
            }
        }
    }
pub fn utf32_to_utf8 < ' c > ( & mut self , input : & ' c [ u32 ] ) -> Result < ( & ' c [ u32 ] , u8 ) , MoreEnum > { // Check if we can pull an u8 from our ring buffer
 match self . my_buf . pop_front ( ) { Some ( v1 ) => { return Result :: Ok ( ( input , v1 ) ) ; } None => { } } let mut my_cursor : & [ u32 ] = input ; // Processing for input being empty case
 if my_cursor . len ( ) == 0 { // Determine if we are at end of data.
 if self . is_last_buffer ( ) { // at end of data condition
 return Result :: Err ( MoreEnum :: More ( 0 ) ) ; } else { // Returning an indication to request a new buffer.
 return Result :: Err ( MoreEnum :: More ( 1024 ) ) ; } } // Grab one UTF32 from input
 let cur_u32 = my_cursor [ 0 ] ; my_cursor = & my_cursor [ 1 .. ] ; // Try to determine the type of UTF32 encoding.
 match classify_utf32 ( cur_u32 ) { Utf8TypeEnum :: Type1 ( v1 ) => { Result :: Ok ( ( my_cursor , v1 ) ) } Utf8TypeEnum :: Type2 ( ( v1 , v2 ) ) => { self . my_buf . push_back ( v2 ) ; Result :: Ok ( ( my_cursor , v1 ) ) } Utf8TypeEnum :: Type3 ( ( v1 , v2 , v3 ) ) => { self . my_buf . push_back ( v2 ) ; self . my_buf . push_back ( v3 ) ; Result :: Ok ( ( my_cursor , v1 ) ) } Utf8TypeEnum :: Type4 ( ( v1 , v2 , v3 , v4 ) ) => { self . my_buf . push_back ( v2 ) ; self . my_buf . push_back ( v3 ) ; self . my_buf . push_back ( v4 ) ; Result :: Ok ( ( my_cursor , v1 ) ) } _ => { // Invalid UTF32 codepoint
 // Emit replacement byte sequence.
 self . signal_invalid_sequence ( ) ; self . my_buf . push_back ( REPLACE_PART2 ) ; self . my_buf . push_back ( REPLACE_PART3 ) ; Result :: Ok ( ( my_cursor , REPLACE_PART1 ) ) } } }
A parser takes in UTF32 slice, and returns a Result object with
either the remaining input and the output byte value, or an MoreEnum
that requests additional data, or an end of data stream condition.
A parser takes in UTF32 slice and returns a Result object with either the remaining input and the output byte value or an MoreEnum that requests additional data or an end of data stream condition .
&mut self
input
&'c [u32]
&mut self
input
&'c [u32]