async fn receive_with_timeout(
        receive_end: &mut ReceiveEnd,
        timeout: Duration,
    ) -> Option<(Instant, TransportPayload)> {
        let wait_for_entries = async move { receive_end.recv().await };
        let ret = timeout_at(Instant::now() + timeout, wait_for_entries).await;
        if ret.is_err() {
            // Return None on timeout.
            return None;
        }

        // Return None on sender disconnect as well.
        ret.unwrap()
    }
/// Receives a message with a given timeout. If timeout expires, returns
/// None.
Receives a message with a given timeout. If timeout expires, returns
None.
Receives a message with a given timeout . If timeout expires returns None .
async fn receive_with_timeout(
        receive_end: &mut ReceiveEnd,
        timeout: Duration,
    ) -> Option<(Instant, TransportPayload)> {
        let wait_for_entries = async move { receive_end.recv().await };
        let ret = timeout_at(Instant::now() + timeout, wait_for_entries).await;
        if ret.is_err() {
            // Return None on timeout.
            return None;
        }
        // Return None on sender disconnect as well.
        ret.unwrap()
    }
async fn receive_with_timeout ( receive_end : & mut ReceiveEnd , timeout : Duration , ) -> Option < ( Instant , TransportPayload ) > { let wait_for_entries = async move { receive_end . recv ( ) . await } ; let ret = timeout_at ( Instant :: now ( ) + timeout , wait_for_entries ) . await ; if ret . is_err ( ) { // Return None on timeout. return None ; } // Return None on sender disconnect as well. ret . unwrap ( ) }
Receives a message with a given timeout.
Receives a message with a given timeout .
receive_end
&mut ReceiveEnd
timeout
Duration
receive_end
&mut ReceiveEnd
timeout
Duration