We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
'static
exec_async
1 parent 171a694 commit 716af43Copy full SHA for 716af43
crates/dispatch2/src/queue.rs
@@ -226,7 +226,9 @@ impl Queue {
226
/// Submit a function for asynchronous execution on the [Queue].
227
pub fn exec_async<F>(&self, work: F)
228
where
229
- F: Send + FnOnce(),
+ // We need `'static` to make sure any referenced values are borrowed for
230
+ // long enough since `work` will be performed asynchronously.
231
+ F: Send + FnOnce() + 'static,
232
{
233
let work_boxed = Box::into_raw(Box::new(work)).cast();
234
0 commit comments