3 ms·
block_on is a executor that polls a future until it returns ready. If the future is not ready then the executor wait until it is woken up. If you poll a future
by ironhaven 3y ago
block_on is a executor that polls a future until it returns ready. If the future is not ready then the executor wait until it is woken up. If you poll a future that relies on a specific runtime (I.g. A async library that uses Tokio) to wake up the executor, with a simple block_on you will get stuck.
A generic block_on in std would be a footgun for new programmers I believe.
- bryanlarsen 3y agoThe proposals to add block_on generally include an executor like pollster.