1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
use std::fmt;

use pulsar_binary_protocol_spec::{
    client_channel::AC_Sender, client_channel_messages::SessionSendHandlerChannelMessage,
    ConnectCommand, ConnectedCommand,
};

mod raw_create_consumer;
mod raw_create_producer;

pub struct AsyncSession {
    sender: AC_Sender<SessionSendHandlerChannelMessage>,
    connect_command: ConnectCommand,
    connected_command: ConnectedCommand,
}
impl AsyncSession {
    #[cfg(any(feature = "futures_io", feature = "tokio02_io", feature = "tokio_io",))]
    pub(crate) fn new(
        sender: AC_Sender<SessionSendHandlerChannelMessage>,
        command_connect: ConnectCommand,
        command_connected: ConnectedCommand,
    ) -> Self {
        Self {
            sender,
            connect_command: command_connect,
            connected_command: command_connected,
        }
    }
}

impl fmt::Debug for AsyncSession {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        f.debug_struct("AsyncSession")
            .field("command_connect", &self.connect_command)
            .field("command_connected", &self.connected_command)
            .finish()
    }
}