pub fn run_until_stalled<F>(&mut self, main_future: &mut F) -> Poll<F::Output>
    where
        F: Future + Unpin,
    {
        let waker = self.singlethreaded_main_task_wake();
        let main_cx = &mut Context::from_waker(&waker);

        let mut res = main_future.poll_unpin(main_cx);

        loop {
            if res.is_ready() {
                return res;
            }

            let packet = match self.inner.port.wait(zx::Time::from_nanos(0)) {
                Ok(packet) => packet,
                Err(zx::Status::TIMED_OUT) => return Poll::Pending,
                Err(status) => panic!("Error calling port wait: {:?}", status),
            };

            match packet.key() {
                EMPTY_WAKEUP_ID => {
                    res = main_future.poll_unpin(main_cx);
                }
                TASK_READY_WAKEUP_ID => self.inner.poll_ready_tasks(),
                receiver_key => {
                    self.inner.deliver_packet(receiver_key as usize, packet);
                }
            }
        }
    }
/// PollResult the future. If it is not ready, dispatch available packets and possibly try again.
/// Timers will not fire. Never blocks.
///
/// Task-local data will not be persisted across different calls to this method.
///
/// This is mainly intended for testing.
///
/// Unpin: this function requires all futures to be `Unpin`able, so any `!Unpin`
/// futures must first be pinned using the `pin_mut!` macro from the `pin-utils` crate.


Task-local data will not be persisted across different calls to this method.

This is mainly intended for testing.


Task - local data will not be persisted across different calls to this method . This is mainly intended for testing .
pub fn run_until_stalled<F>(&mut self, main_future: &mut F) -> Poll<F::Output>
    where
        F: Future + Unpin,
    {
        let waker = self.singlethreaded_main_task_wake();
        let main_cx = &mut Context::from_waker(&waker);
        let mut res = main_future.poll_unpin(main_cx);
        loop {
            if res.is_ready() {
                return res;
            }
            let packet = match self.inner.port.wait(zx::Time::from_nanos(0)) {
                Ok(packet) => packet,
                Err(zx::Status::TIMED_OUT) => return Poll::Pending,
                Err(status) => panic!("Error calling port wait: {:?}", status),
            };
            match packet.key() {
                EMPTY_WAKEUP_ID => {
                    res = main_future.poll_unpin(main_cx);
                }
                TASK_READY_WAKEUP_ID => self.inner.poll_ready_tasks(),
                receiver_key => {
                    self.inner.deliver_packet(receiver_key as usize, packet);
                }
            }
        }
    }
pub fn run_until_stalled < F > ( & mut self , main_future : & mut F ) -> Poll < F :: Output > where F : Future + Unpin , { let waker = self . singlethreaded_main_task_wake ( ) ; let main_cx = & mut Context :: from_waker ( & waker ) ; let mut res = main_future . poll_unpin ( main_cx ) ; loop { if res . is_ready ( ) { return res ; } let packet = match self . inner . port . wait ( zx :: Time :: from_nanos ( 0 ) ) { Ok ( packet ) => packet , Err ( zx :: Status :: TIMED_OUT ) => return Poll :: Pending , Err ( status ) => panic ! ( " " status ) , } ; match packet . key ( ) { EMPTY_WAKEUP_ID => { res = main_future . poll_unpin ( main_cx ) ; } TASK_READY_WAKEUP_ID => self . inner . poll_ready_tasks ( ) , receiver_key => { self . inner . deliver_packet ( receiver_key as usize , packet ) ; } } } }
PollResult the future.
PollResult the future .
&mut self
main_future
&mut F
&mut self
main_future
&mut F