fn receive_data_internal(&mut self, bytes: &[u8]) -> Vec<ProcedureRequest> {
        let mut procedure_requests = Vec::new();
        let mut cursor = Cursor::new(&bytes);

        // at::Command::deserialize will parse bytes until it runs out of parseable bytes or hits
        // an error. Then it will return all parsed values with an optional error.  If there is an
        // error, there may still be bytes to parse after the error is handled.  If there is no
        // error, there are no more parseable bytes.  This outer loop repeatedly calls deserialize
        // until there is no error.
        'read_all_bytes: loop {
            let parse_result =
                at::Command::deserialize(&mut cursor, std::mem::take(&mut self.unparsed_bytes));
            // Parse the byte buffer into a HF message.
            self.unparsed_bytes = parse_result.remaining_bytes;

            // This inner loop loops over parsed values and converts them to procedure requests.
            'process_commands: for command in parse_result.values {
                debug!("Received {:?}", command);
                // Attempt to match the received command to a procedure.
                let procedure_id = match self.match_command_to_procedure(&command) {
                    Ok(id) => id,
                    Err(e) => {
                        procedure_requests.push(e.into());
                        continue 'process_commands;
                    }
                };

                // Handle the received HF commend.
                let procedure_request = self.handle_command(procedure_id, command.into());
                procedure_requests.push(procedure_request);
            }

            if let Some(err) = parse_result.error {
                procedure_requests.push(ProcedureError::UnparsableHf(err).into());
            } else {
                // If there's no error and we're out of parsed values, we've done everything we can.
                break 'read_all_bytes;
            }
        }

        procedure_requests
    }
/// Consume bytes from the peer (HF), producing a parsed at::Command from the bytes and
/// handling it. Internal helper method for `Self::receive_data`.
///
/// Returns the request from handling the command.
Consume bytes from the peer (HF), producing a parsed at::Command from the bytes and
handling it. Internal helper method for `Self::receive_data`.

Returns the request from handling the command.
Consume bytes from the peer ( HF ) producing a parsed at :: Command from the bytes and handling it . Internal helper method for ` Self :: receive_data ` . Returns the request from handling the command .
fn receive_data_internal(&mut self, bytes: &[u8]) -> Vec<ProcedureRequest> {
        let mut procedure_requests = Vec::new();
        let mut cursor = Cursor::new(&bytes);
        // at::Command::deserialize will parse bytes until it runs out of parseable bytes or hits
        // an error. Then it will return all parsed values with an optional error.  If there is an
        // error, there may still be bytes to parse after the error is handled.  If there is no
        // error, there are no more parseable bytes.  This outer loop repeatedly calls deserialize
        // until there is no error.
        'read_all_bytes: loop {
            let parse_result =
                at::Command::deserialize(&mut cursor, std::mem::take(&mut self.unparsed_bytes));
            // Parse the byte buffer into a HF message.
            self.unparsed_bytes = parse_result.remaining_bytes;
            // This inner loop loops over parsed values and converts them to procedure requests.
            'process_commands: for command in parse_result.values {
                debug!("Received {:?}", command);
                // Attempt to match the received command to a procedure.
                let procedure_id = match self.match_command_to_procedure(&command) {
                    Ok(id) => id,
                    Err(e) => {
                        procedure_requests.push(e.into());
                        continue 'process_commands;
                    }
                };
                // Handle the received HF commend.
                let procedure_request = self.handle_command(procedure_id, command.into());
                procedure_requests.push(procedure_request);
            }
            if let Some(err) = parse_result.error {
                procedure_requests.push(ProcedureError::UnparsableHf(err).into());
            } else {
                // If there's no error and we're out of parsed values, we've done everything we can.
                break 'read_all_bytes;
            }
        }
        procedure_requests
    }
fn receive_data_internal ( & mut self , bytes : & [ u8 ] ) -> Vec < ProcedureRequest > { let mut procedure_requests = Vec :: new ( ) ; let mut cursor = Cursor :: new ( & bytes ) ; // at::Command::deserialize will parse bytes until it runs out of parseable bytes or hits // an error. Then it will return all parsed values with an optional error.  If there is an // error, there may still be bytes to parse after the error is handled.  If there is no // error, there are no more parseable bytes.  This outer loop repeatedly calls deserialize // until there is no error. ' read_all_bytes : loop { let parse_result = at :: Command :: deserialize ( & mut cursor , std :: mem :: take ( & mut self . unparsed_bytes ) ) ; // Parse the byte buffer into a HF message. self . unparsed_bytes = parse_result . remaining_bytes ; // This inner loop loops over parsed values and converts them to procedure requests. ' process_commands : for command in parse_result . values { debug ! ( " " command ) ; // Attempt to match the received command to a procedure. let procedure_id = match self . match_command_to_procedure ( & command ) { Ok ( id ) => id , Err ( e ) => { procedure_requests . push ( e . into ( ) ) ; continue ' process_commands ; } } ; // Handle the received HF commend. let procedure_request = self . handle_command ( procedure_id , command . into ( ) ) ; procedure_requests . push ( procedure_request ) ; } if let Some ( err ) = parse_result . error { procedure_requests . push ( ProcedureError :: UnparsableHf ( err ) . into ( ) ) ; } else { // If there's no error and we're out of parsed values, we've done everything we can. break ' read_all_bytes ; } } procedure_requests }
Consume bytes from the peer (HF), producing a parsed at::Command from the bytes and
handling it.
Consume bytes from the peer ( HF ) producing a parsed at :: Command from the bytes and handling it .
&mut self
bytes
&[u8]
&mut self
bytes
&[u8]