pulsar_binary_protocol_spec/client_handler/
handle_pong.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::{commands::PongCommand, protos::protobuf::pulsar_api::BaseCommand};

use super::{HandlerHandleError, HandlerHandleOutput};

pub(super) fn handle_pong(
    base_command: &BaseCommand,
) -> Result<HandlerHandleOutput, HandlerHandleError> {
    if let Some(c) = base_command.pong.as_ref() {
        let c = PongCommand {
            inner_command: c.to_owned(),
        };
        Ok(HandlerHandleOutput::OnPingResponded(c))
    } else {
        Err(HandlerHandleError::BaseCommandInvalid(
            base_command.to_owned(),
        ))
    }
}