(future: F)
| 627 | // ============================================================ |
| 628 | |
| 629 | fn pollster_block_on<F: std::future::Future>(future: F) -> F::Output { |
| 630 | use std::task::{Context, Poll, Wake, Waker}; |
| 631 | use std::pin::Pin; |
| 632 | use std::sync::Arc; |
| 633 | struct NoopWaker; |
| 634 | impl Wake for NoopWaker { fn wake(self: Arc<Self>) {} } |
| 635 | let waker = Waker::from(Arc::new(NoopWaker)); |
| 636 | let mut cx = Context::from_waker(&waker); |
| 637 | let mut future = unsafe { Pin::new_unchecked(Box::new(future)) }; |
| 638 | loop { |
| 639 | match future.as_mut().poll(&mut cx) { |
| 640 | Poll::Ready(result) => return result, |
| 641 | Poll::Pending => { |
| 642 | pump_run_loop(0.001); |
| 643 | } |
| 644 | } |
| 645 | } |
| 646 | } |
| 647 | |
| 648 | // ============================================================ |
| 649 | // FFI entry points |
no test coverage detected