pub fn utf8_to_char<'b>(&mut self, input: &'b [u8])
    -> Result<(&'b [u8], char), MoreEnum> {
        let mut my_cursor: &[u8] = input;
        let last_buffer = self.my_last_buffer;
        // Fill buffer phase.
        loop {
            if self.my_buf.is_full() || (my_cursor.len() == 0) {
                break;
            }
            // Push a u8, and advance input position.
            self.my_buf.push_back(my_cursor[0]);
            my_cursor = &my_cursor[1..];
        }
        if self.my_buf.is_empty() {
            // Processing for buffer being empty case
            // Determine if we are at end of data.
            if last_buffer {
                // at end of data condition
                Result::Err(MoreEnum::More(0))
            }
            else {
                // Returning an indication to request a new buffer.
                Result::Err(MoreEnum::More(4096))
            }
        }
        else {
            match utf8_decode(& mut self.my_buf, last_buffer) {
                Utf8EndEnum::BadDecode(_) => {
                    self.signal_invalid_sequence();
                    Result::Ok((my_cursor, char::REPLACEMENT_CHARACTER))
                }
                Utf8EndEnum::Finish(code) => {
                    // Unsafe is justified because utf8_decode() finite state
                    // machine checks for all cases of invalid decodes.
                    let ch = unsafe { char::from_u32_unchecked(code) };
                    Result::Ok((my_cursor, ch))
                }
                Utf8EndEnum::TypeUnknown => {
                    // Insufficient data to decode.
                    if last_buffer {
                        self.signal_invalid_sequence();
                        // Buffer should be empty at this point.
                        Result::Ok((my_cursor, char::REPLACEMENT_CHARACTER))
                    }
                    else {
                        // Return an indication to request a new buffer.
                        Result::Err(MoreEnum::More(4096))
                    }
                }
            }
        }
    }
/// A parser takes in byte slice, and returns a Result object with
/// either the remaining input and the output char value, or an MoreEnum
/// that requests additional data, or an end of data stream condition.
///
/// Invalid UTF8 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 byte slice, and returns a Result object with
either the remaining input and the output char value, or an MoreEnum
that requests additional data, or an end of data stream condition.

Invalid UTF8 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 byte slice and returns a Result object with either the remaining input and the output char value or an MoreEnum that requests additional data or an end of data stream condition . Invalid UTF8 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 utf8_to_char<'b>(&mut self, input: &'b [u8])
    -> Result<(&'b [u8], char), MoreEnum> {
        let mut my_cursor: &[u8] = input;
        let last_buffer = self.my_last_buffer;
        // Fill buffer phase.
        loop {
            if self.my_buf.is_full() || (my_cursor.len() == 0) {
                break;
            }
            // Push a u8, and advance input position.
            self.my_buf.push_back(my_cursor[0]);
            my_cursor = &my_cursor[1..];
        }
        if self.my_buf.is_empty() {
            // Processing for buffer being empty case
            // Determine if we are at end of data.
            if last_buffer {
                // at end of data condition
                Result::Err(MoreEnum::More(0))
            }
            else {
                // Returning an indication to request a new buffer.
                Result::Err(MoreEnum::More(4096))
            }
        }
        else {
            match utf8_decode(& mut self.my_buf, last_buffer) {
                Utf8EndEnum::BadDecode(_) => {
                    self.signal_invalid_sequence();
                    Result::Ok((my_cursor, char::REPLACEMENT_CHARACTER))
                }
                Utf8EndEnum::Finish(code) => {
                    // Unsafe is justified because utf8_decode() finite state
                    // machine checks for all cases of invalid decodes.
                    let ch = unsafe { char::from_u32_unchecked(code) };
                    Result::Ok((my_cursor, ch))
                }
                Utf8EndEnum::TypeUnknown => {
                    // Insufficient data to decode.
                    if last_buffer {
                        self.signal_invalid_sequence();
                        // Buffer should be empty at this point.
                        Result::Ok((my_cursor, char::REPLACEMENT_CHARACTER))
                    }
                    else {
                        // Return an indication to request a new buffer.
                        Result::Err(MoreEnum::More(4096))
                    }
                }
            }
        }
    }
pub fn utf8_to_char < ' b > ( & mut self , input : & ' b [ u8 ] ) -> Result < ( & ' b [ u8 ] , char ) , MoreEnum > { let mut my_cursor : & [ u8 ] = input ; let last_buffer = self . my_last_buffer ; // Fill buffer phase.
 loop { if self . my_buf . is_full ( ) || ( my_cursor . len ( ) == 0 ) { break ; } // Push a u8, and advance input position.
 self . my_buf . push_back ( my_cursor [ 0 ] ) ; my_cursor = & my_cursor [ 1 .. ] ; } if self . my_buf . is_empty ( ) { // Processing for buffer being empty case
 // Determine if we are at end of data.
 if last_buffer { // at end of data condition
 Result :: Err ( MoreEnum :: More ( 0 ) ) } else { // Returning an indication to request a new buffer.
 Result :: Err ( MoreEnum :: More ( 4096 ) ) } } else { match utf8_decode ( & mut self . my_buf , last_buffer ) { Utf8EndEnum :: BadDecode ( _ ) => { self . signal_invalid_sequence ( ) ; Result :: Ok ( ( my_cursor , char :: REPLACEMENT_CHARACTER ) ) } Utf8EndEnum :: Finish ( code ) => { // Unsafe is justified because utf8_decode() finite state
 // machine checks for all cases of invalid decodes.
 let ch = unsafe { char :: from_u32_unchecked ( code ) } ; Result :: Ok ( ( my_cursor , ch ) ) } Utf8EndEnum :: TypeUnknown => { // Insufficient data to decode.
 if last_buffer { self . signal_invalid_sequence ( ) ; // Buffer should be empty at this point.
 Result :: Ok ( ( my_cursor , char :: REPLACEMENT_CHARACTER ) ) } else { // Return an indication to request a new buffer.
 Result :: Err ( MoreEnum :: More ( 4096 ) ) } } } } }
A parser takes in byte slice, and returns a Result object with
either the remaining input and the output char value, or an MoreEnum
that requests additional data, or an end of data stream condition.
A parser takes in byte slice and returns a Result object with either the remaining input and the output char value or an MoreEnum that requests additional data or an end of data stream condition .
&mut self
input
&'b [u8]
&mut self
input
&'b [u8]