async fn read_chan_dyn<P, E, R>(chan: &mut Chan<P, E, R>, timeout: Duration) -> SessionResult<R> {
    match chan.stash.take() {
        Some(msg) => Ok(msg),
        None if timeout == Duration::MAX => match chan.rx.recv().await {
            Some(msg) => Ok(msg),
            None => Err(SessionError::Disconnected),
        },
        None => match timeout_after(timeout, chan.rx.recv()).await {
            Ok(Some(msg)) => Ok(msg),
            Ok(None) => Err(SessionError::Disconnected),
            Err(_) => Err(SessionError::Timeout),
        },
    }
}
/// Try to read a dynamically typed message from the stash of from the channel.
Try to read a dynamically typed message from the stash of from the channel.
Try to read a dynamically typed message from the stash of from the channel .
async fn read_chan_dyn<P, E, R>(chan: &mut Chan<P, E, R>, timeout: Duration) -> SessionResult<R> {
    match chan.stash.take() {
        Some(msg) => Ok(msg),
        None if timeout == Duration::MAX => match chan.rx.recv().await {
            Some(msg) => Ok(msg),
            None => Err(SessionError::Disconnected),
        },
        None => match timeout_after(timeout, chan.rx.recv()).await {
            Ok(Some(msg)) => Ok(msg),
            Ok(None) => Err(SessionError::Disconnected),
            Err(_) => Err(SessionError::Timeout),
        },
    }
}
async fn read_chan_dyn < P , E , R > ( chan : & mut Chan < P , E , R > , timeout : Duration ) -> SessionResult < R > { match chan . stash . take ( ) { Some ( msg ) => Ok ( msg ) , None if timeout == Duration :: MAX => match chan . rx . recv ( ) . await { Some ( msg ) => Ok ( msg ) , None => Err ( SessionError :: Disconnected ) , } , None => match timeout_after ( timeout , chan . rx . recv ( ) ) . await { Ok ( Some ( msg ) ) => Ok ( msg ) , Ok ( None ) => Err ( SessionError :: Disconnected ) , Err ( _ ) => Err ( SessionError :: Timeout ) , } , } }
Try to read a dynamically typed message from the stash of from the channel.
Try to read a dynamically typed message from the stash of from the channel .
chan
&mut Chan<P, E, R>
timeout
Duration