(task: impl Future<Output = ()> + 'static)
| 483 | /// immediately with its result. |
| 484 | #[doc(hidden)] |
| 485 | pub fn start_task(task: impl Future<Output = ()> + 'static) -> i32 { |
| 486 | // Allocate a new `FutureState` which will track all state necessary for |
| 487 | // our exported task. |
| 488 | let state = Box::into_raw(Box::new(FutureState::new(Box::pin(task)))); |
| 489 | |
| 490 | // Store our `FutureState` into our context-local-storage slot and then |
| 491 | // pretend we got EVENT_NONE to kick off everything. |
| 492 | // |
| 493 | // SAFETY: we should own `context.set` as we're the root level exported |
| 494 | // task, and then `callback` is only invoked when context-local storage is |
| 495 | // valid. |
| 496 | unsafe { |
| 497 | assert!(context_get().is_null()); |
| 498 | context_set(state.cast()); |
| 499 | callback(EVENT_NONE, 0, 0) as i32 |
| 500 | } |
| 501 | } |
| 502 | |
| 503 | /// Handle a progress notification from the host regarding either a call to an |
| 504 | /// async-lowered import or a stream/future read/write operation. |
nothing calls this directly
no test coverage detected