Skip to main content

spawn_with_driver

Function spawn_with_driver 

Source
pub async unsafe fn spawn_with_driver<F, Driver, Run, Map, T>(
    manager: &'static Manager,
    parent: TaskIdentifier,
    name: &str,
    stack: Stack,
    entry: F,
    driver: Run,
    map: Map,
) -> Result<(JoinHandle<T>, TaskIdentifier)>
where F: FnOnce() -> i32 + 'static, Driver: Future<Output = i32> + 'static, Run: FnOnce(Coroutine) -> Driver + 'static, Map: FnOnce(i32) -> T + 'static, T: 'static,
Expand description

Like spawn_with_result, with a local future that drives the entry coroutine.

§Safety

Same contract as spawn. The driver must keep all native execution on the task’s executor and stop it before releasing the resources borrowed by the entry.