fn try_complete(
                fut: &mut Pin<&mut Recv<i32>>,
                cx: &mut Context,
                other_cx: &mut Context,
                test_waker: &TestWaker,
                other_test_waker: &TestWaker,
                expect: Result<i32, RecvError>,
            ) -> bool {
                let res = fut.as_mut().poll(cx);

                // If `Ready` is returned we are done.
                if let Poll::Ready(val) = res {
                    assert_eq!(val, expect);
                    return true;
                }

                // The sender should not have used the other waker even if it
                // was registered before the last call to `poll`.
                assert_eq!(other_test_waker.take_count(), 0);

                // Although the last call to `poll` has returned `Pending`, the
                // sender may have been consumed in the meantime so check
                // whether there is a notification.
                let event_count = test_waker.take_count();
                if event_count != 0 {
                    // Expect only one notification.
                    assert_eq!(event_count, 1);

                    // Since the task was notified it is expected that the
                    // future is now ready.
                    let res = fut.as_mut().poll(other_cx);
                    assert_eq!(test_waker.take_count(), 0);
                    assert_eq!(other_test_waker.take_count(), 0);
                    assert_eq!(res, Poll::Ready(expect));
                    return true;
                }

                // The future was not polled to completion.
                false
            }
// Attempt to poll the future to completion with the provided context.
Attempt to poll the future to completion with the provided context.
Attempt to poll the future to completion with the provided context .
fn try_complete(
                fut: &mut Pin<&mut Recv<i32>>,
                cx: &mut Context,
                other_cx: &mut Context,
                test_waker: &TestWaker,
                other_test_waker: &TestWaker,
                expect: Result<i32, RecvError>,
            ) -> bool {
                let res = fut.as_mut().poll(cx);
                // If `Ready` is returned we are done.
                if let Poll::Ready(val) = res {
                    assert_eq!(val, expect);
                    return true;
                }
                // The sender should not have used the other waker even if it
                // was registered before the last call to `poll`.
                assert_eq!(other_test_waker.take_count(), 0);
                // Although the last call to `poll` has returned `Pending`, the
                // sender may have been consumed in the meantime so check
                // whether there is a notification.
                let event_count = test_waker.take_count();
                if event_count != 0 {
                    // Expect only one notification.
                    assert_eq!(event_count, 1);
                    // Since the task was notified it is expected that the
                    // future is now ready.
                    let res = fut.as_mut().poll(other_cx);
                    assert_eq!(test_waker.take_count(), 0);
                    assert_eq!(other_test_waker.take_count(), 0);
                    assert_eq!(res, Poll::Ready(expect));
                    return true;
                }
                // The future was not polled to completion.
                false
            }
fn try_complete ( fut : & mut Pin < & mut Recv < i32 > > , cx : & mut Context , other_cx : & mut Context , test_waker : & TestWaker , other_test_waker : & TestWaker , expect : Result < i32 , RecvError > , ) -> bool { let res = fut . as_mut ( ) . poll ( cx ) ; // If `Ready` is returned we are done. if let Poll :: Ready ( val ) = res { assert_eq ! ( val expect ) ; return true ; } // The sender should not have used the other waker even if it // was registered before the last call to `poll`. assert_eq ! ( other_test_waker take_count ( ) 0 ) ; // Although the last call to `poll` has returned `Pending`, the // sender may have been consumed in the meantime so check // whether there is a notification. let event_count = test_waker . take_count ( ) ; if event_count != 0 { // Expect only one notification. assert_eq ! ( event_count 1 ) ; // Since the task was notified it is expected that the // future is now ready. let res = fut . as_mut ( ) . poll ( other_cx ) ; assert_eq ! ( test_waker take_count ( ) 0 ) ; assert_eq ! ( other_test_waker take_count ( ) 0 ) ; assert_eq ! ( res Poll Ready ( expect ) ) ; return true ; } // The future was not polled to completion. false }
Attempt to poll the future to completion with the provided context.
Attempt to poll the future to completion with the provided context .
fut
&mut Pin<&mut Recv<i32>>
cx
&mut Context
other_cx
&mut Context
test_waker
&TestWaker
other_test_waker
&TestWaker
expect
Result<i32, RecvError>