pub fn open_channel(
        &mut self,
        channel: PacketChannel,
        buffer_size: usize,
    ) -> Result<
        (
            Sender<MuxPacket<P>>,
            Receiver<MuxPacket<P>>,
            ChannelStatistics,
        ),
        DuplicateChannel,
    > {
        let statistics = Arc::new(ChannelStatisticsData::default());
        match self.incoming.entry(channel) {
            hash_map::Entry::Occupied(_) => Err(DuplicateChannel),
            hash_map::Entry::Vacant(vacant) => {
                let (incoming_sender, incoming_receiver) = mpsc::channel(buffer_size);
                let (outgoing_sender, outgoing_receiver) = mpsc::channel(buffer_size);
                vacant.insert(ChannelSender {
                    sender: incoming_sender,
                    statistics: Arc::clone(&statistics),
                });
                self.outgoing.push(ChannelReceiver {
                    channel,
                    receiver: outgoing_receiver,
                    statistics: Arc::clone(&statistics),
                });
                Ok((
                    outgoing_sender,
                    incoming_receiver,
                    ChannelStatistics(statistics),
                ))
            }
        }
    }
/// Open a multiplexed packet channel, producing a sender for outgoing `MuxPacket`s on this
/// channel, and a receiver for incoming `MuxPacket`s on this channel.
///
/// The `buffer_size` parameter controls the buffer size requested when creating the MPSC
/// futures channels for the returned `Sender` and `Receiver`.
Open a multiplexed packet channel, producing a sender for outgoing `MuxPacket`s on this
channel, and a receiver for incoming `MuxPacket`s on this channel.


Open a multiplexed packet channel producing a sender for outgoing ` MuxPacket ` s on this channel and a receiver for incoming ` MuxPacket ` s on this channel .
pub fn open_channel(
        &mut self,
        channel: PacketChannel,
        buffer_size: usize,
    ) -> Result<
        (
            Sender<MuxPacket<P>>,
            Receiver<MuxPacket<P>>,
            ChannelStatistics,
        ),
        DuplicateChannel,
    > {
        let statistics = Arc::new(ChannelStatisticsData::default());
        match self.incoming.entry(channel) {
            hash_map::Entry::Occupied(_) => Err(DuplicateChannel),
            hash_map::Entry::Vacant(vacant) => {
                let (incoming_sender, incoming_receiver) = mpsc::channel(buffer_size);
                let (outgoing_sender, outgoing_receiver) = mpsc::channel(buffer_size);
                vacant.insert(ChannelSender {
                    sender: incoming_sender,
                    statistics: Arc::clone(&statistics),
                });
                self.outgoing.push(ChannelReceiver {
                    channel,
                    receiver: outgoing_receiver,
                    statistics: Arc::clone(&statistics),
                });
                Ok((
                    outgoing_sender,
                    incoming_receiver,
                    ChannelStatistics(statistics),
                ))
            }
        }
    }
pub fn open_channel ( & mut self , channel : PacketChannel , buffer_size : usize , ) -> Result < ( Sender < MuxPacket < P > > , Receiver < MuxPacket < P > > , ChannelStatistics , ) , DuplicateChannel , > { let statistics = Arc :: new ( ChannelStatisticsData :: default ( ) ) ; match self . incoming . entry ( channel ) { hash_map :: Entry :: Occupied ( _ ) => Err ( DuplicateChannel ) , hash_map :: Entry :: Vacant ( vacant ) => { let ( incoming_sender , incoming_receiver ) = mpsc :: channel ( buffer_size ) ; let ( outgoing_sender , outgoing_receiver ) = mpsc :: channel ( buffer_size ) ; vacant . insert ( ChannelSender { sender : incoming_sender , statistics : Arc :: clone ( & statistics ) , } ) ; self . outgoing . push ( ChannelReceiver { channel , receiver : outgoing_receiver , statistics : Arc :: clone ( & statistics ) , } ) ; Ok ( ( outgoing_sender , incoming_receiver , ChannelStatistics ( statistics ) , ) ) } } }
Open a multiplexed packet channel, producing a sender for outgoing `MuxPacket`s on this
channel, and a receiver for incoming `MuxPacket`s on this channel.
Open a multiplexed packet channel producing a sender for outgoing ` MuxPacket ` s on this channel and a receiver for incoming ` MuxPacket ` s on this channel .
&mut self
channel
PacketChannel
buffer_size
usize
&mut self
channel
PacketChannel
buffer_size
usize