fn handle_incoming_request<F>(
        &mut self,
        pid: P,
        msg: R,
        init_server: &mut F,
    ) -> Option<Receiver<R>>
    where
        F: FnMut(P, Sender<SessionError>) -> (Sender<R>, Receiver<R>),
    {
        match self.demux.txs.entry(pid) {
            Entry::Vacant(e) => {
                let (tx, rx) = init_server(pid, self.errors.tx.clone());
                let _ = tx.send(msg);
                e.insert(tx);
                Some(rx)
            }
            Entry::Occupied(e) => {
                // Ignoring send errors here; it means the channel is closed, but we'll realize that in the loop.
                let _ = e.get().send(msg);
                None
            }
        }
    }
/// Dispatch an incoming request to the corresponding session.
///
/// Initialize the session handler if it doesn't exist yet.
/// If we initiated a new handler, return the channel where
/// we can receive messages from it.
Dispatch an incoming request to the corresponding session.
Initialize the session handler if it doesn't exist yet.
If we initiated a new handler, return the channel where
we can receive messages from it.
Dispatch an incoming request to the corresponding session . Initialize the session handler if it doesn ' t exist yet . If we initiated a new handler return the channel where we can receive messages from it .
fn handle_incoming_request<F>(
        &mut self,
        pid: P,
        msg: R,
        init_server: &mut F,
    ) -> Option<Receiver<R>>
    where
        F: FnMut(P, Sender<SessionError>) -> (Sender<R>, Receiver<R>),
    {
        match self.demux.txs.entry(pid) {
            Entry::Vacant(e) => {
                let (tx, rx) = init_server(pid, self.errors.tx.clone());
                let _ = tx.send(msg);
                e.insert(tx);
                Some(rx)
            }
            Entry::Occupied(e) => {
                // Ignoring send errors here; it means the channel is closed, but we'll realize that in the loop.
                let _ = e.get().send(msg);
                None
            }
        }
    }
fn handle_incoming_request < F > ( & mut self , pid : P , msg : R , init_server : & mut F , ) -> Option < Receiver < R > > where F : FnMut ( P , Sender < SessionError > ) -> ( Sender < R > , Receiver < R > ) , { match self . demux . txs . entry ( pid ) { Entry :: Vacant ( e ) => { let ( tx , rx ) = init_server ( pid , self . errors . tx . clone ( ) ) ; let _ = tx . send ( msg ) ; e . insert ( tx ) ; Some ( rx ) } Entry :: Occupied ( e ) => { // Ignoring send errors here; it means the channel is closed, but we'll realize that in the loop. let _ = e . get ( ) . send ( msg ) ; None } } }
Dispatch an incoming request to the corresponding session.
Dispatch an incoming request to the corresponding session .
&mut self
pid
P
msg
R
init_server
&mut F