fn send_status_response(
    command: impl IncomingTargetCommand,
    result: Result<Box<dyn PacketEncodable>, StatusCode>,
    pdu_id: PduId,
) -> Result<(), Error> {
    match result {
        Ok(encodable) => {
            match encodable.encode_packets() {
                Ok(mut packets) => {
                    let first_packet = packets.remove(0);
                    // TODO(41699): send the first packet and push the other packets in this list,
                    //   if any, into a continuation on the inner.
                    command
                        .send_response(AvcResponseType::ImplementedStable, &first_packet[..])
                        .map_err(|e| Error::AvctpError(e))
                }
                Err(e) => {
                    fx_log_err!("Error trying to encode response packet. Sending internal_error rejection to peer {:?}", e);
                    send_avc_reject(command, u8::from(&pdu_id), StatusCode::InternalError)
                }
            }
        }
        Err(status_code) => {
            fx_log_err!(
                "Error trying to encode response packet. Sending rejection to peer {:?}",
                status_code
            );
            send_avc_reject(command, u8::from(&pdu_id), status_code)
        }
    }
}
/// Sends status command response. Send's Implemented/Stable on response code on success.
Sends status command response. Send's Implemented/Stable on response code on success.
Sends status command response . Send ' s Implemented / Stable on response code on success .
fn send_status_response(
    command: impl IncomingTargetCommand,
    result: Result<Box<dyn PacketEncodable>, StatusCode>,
    pdu_id: PduId,
) -> Result<(), Error> {
    match result {
        Ok(encodable) => {
            match encodable.encode_packets() {
                Ok(mut packets) => {
                    let first_packet = packets.remove(0);
                    // TODO(41699): send the first packet and push the other packets in this list,
                    //   if any, into a continuation on the inner.
                    command
                        .send_response(AvcResponseType::ImplementedStable, &first_packet[..])
                        .map_err(|e| Error::AvctpError(e))
                }
                Err(e) => {
                    fx_log_err!("Error trying to encode response packet. Sending internal_error rejection to peer {:?}", e);
                    send_avc_reject(command, u8::from(&pdu_id), StatusCode::InternalError)
                }
            }
        }
        Err(status_code) => {
            fx_log_err!(
                "Error trying to encode response packet. Sending rejection to peer {:?}",
                status_code
            );
            send_avc_reject(command, u8::from(&pdu_id), status_code)
        }
    }
}
fn send_status_response ( command : impl IncomingTargetCommand , result : Result < Box < dyn PacketEncodable > , StatusCode > , pdu_id : PduId , ) -> Result < ( ) , Error > { match result { Ok ( encodable ) => { match encodable . encode_packets ( ) { Ok ( mut packets ) => { let first_packet = packets . remove ( 0 ) ; // TODO(41699): send the first packet and push the other packets in this list, //   if any, into a continuation on the inner. command . send_response ( AvcResponseType :: ImplementedStable , & first_packet [ .. ] ) . map_err ( | e | Error :: AvctpError ( e ) ) } Err ( e ) => { fx_log_err ! ( " " e ) ; send_avc_reject ( command , u8 :: from ( & pdu_id ) , StatusCode :: InternalError ) } } } Err ( status_code ) => { fx_log_err ! ( " " status_code ) ; send_avc_reject ( command , u8 :: from ( & pdu_id ) , status_code ) } } }
Sends status command response.
Sends status command response .
command
impl IncomingTargetCommand
result
Result<Box<dyn PacketEncodable>, StatusCode>
pdu_id
PduId
command
impl IncomingTargetCommand
result
Result<Box<dyn PacketEncodable>, StatusCode>
pdu_id
PduId