affinitypool

Function execute

Source
pub async fn execute<'scope, F, R>(func: F) -> R
where F: FnOnce() -> R + Send + 'scope, R: Send + 'static,
Expand description

Queue a new command for execution on the global threadpool

This function is safe, as long as the caller ensures that the returned future is awaited and fully driven to completion. The caller must ensure that the lifetime ’scope is valid until the returned future is fully driven.

§Panics

This function panics if a global threadpool has not been created.