fn parse_frames(&mut self) {
        // Start of next message
        let mut start = 0;

        // Position of last termination in buffer
        let mut last_termination = None;

        while !self.faulty {
            let termination = self.parse_frame(start);
            // No more frames left
            if termination.is_none() {
                break;
            }

            start = termination.unwrap() + 1;
            last_termination = termination;
        }

        // No message was found, so buffer can stay unchanged
        if last_termination.is_none() {
            return;
        }

        // No unparsed data remaining in buffer
        if (last_termination.unwrap() + 1) == self.buffer.len() {
            return self.buffer.clear();
        }

        self.buffer.drain(..=last_termination.unwrap());
    }
/// Parses buffer and extracts messages
/// Buffer is drained to only contain non-complete messages
Parses buffer and extracts messages
Buffer is drained to only contain non-complete messages
Parses buffer and extracts messages Buffer is drained to only contain non - complete messages
fn parse_frames(&mut self) {
        // Start of next message
        let mut start = 0;
        // Position of last termination in buffer
        let mut last_termination = None;
        while !self.faulty {
            let termination = self.parse_frame(start);
            // No more frames left
            if termination.is_none() {
                break;
            }
            start = termination.unwrap() + 1;
            last_termination = termination;
        }
        // No message was found, so buffer can stay unchanged
        if last_termination.is_none() {
            return;
        }
        // No unparsed data remaining in buffer
        if (last_termination.unwrap() + 1) == self.buffer.len() {
            return self.buffer.clear();
        }
        self.buffer.drain(..=last_termination.unwrap());
    }
fn parse_frames ( & mut self ) { // Start of next message let mut start = 0 ; // Position of last termination in buffer let mut last_termination = None ; while ! self . faulty { let termination = self . parse_frame ( start ) ; // No more frames left if termination . is_none ( ) { break ; } start = termination . unwrap ( ) + 1 ; last_termination = termination ; } // No message was found, so buffer can stay unchanged if last_termination . is_none ( ) { return ; } // No unparsed data remaining in buffer if ( last_termination . unwrap ( ) + 1 ) == self . buffer . len ( ) { return self . buffer . clear ( ) ; } self . buffer . drain ( .. = last_termination . unwrap ( ) ) ; }
Parses buffer and extracts messages
Buffer is drained to only contain non-complete messages
Parses buffer and extracts messages Buffer is drained to only contain non - complete messages
&mut self
&mut self