Lines Matching full:schedule
23 /// When the task is woken, its [`Runnable`] is passed to the `schedule` function.
24 /// The `schedule` function should not attempt to run the [`Runnable`] nor to drop it. Instead, it
40 /// let schedule = move |runnable| s.send(runnable).unwrap();
42 /// // Create a task with the future and the schedule function.
43 /// let (runnable, task) = async_task::spawn(future, schedule);
45 pub fn spawn<F, S>(future: F, schedule: S) -> (Runnable, Task<F::Output>) in spawn()
51 unsafe { spawn_unchecked(future, schedule) } in spawn()
81 /// let schedule = move |runnable| s.send(runnable).unwrap();
83 /// // Create a task with the future and the schedule function.
84 /// let (runnable, task) = async_task::spawn_local(future, schedule);
87 pub fn spawn_local<F, S>(future: F, schedule: S) -> (Runnable, Task<F::Output>) in spawn_local()
142 unsafe { spawn_unchecked(future, schedule) } in spawn_local()
148 /// `'static` on `future` and `schedule`.
155 /// - If `schedule` is not [`Send`] and [`Sync`], the task's [`Waker`] must be used and dropped on
157 /// - If `schedule` is not `'static`, borrowed variables must outlive the task's [`Waker`].
169 /// let schedule = move |runnable| s.send(runnable).unwrap();
171 /// // Create a task with the future and the schedule function.
172 /// let (runnable, task) = unsafe { async_task::spawn_unchecked(future, schedule) };
174 pub unsafe fn spawn_unchecked<F, S>(future: F, schedule: S) -> (Runnable, Task<F::Output>) in spawn_unchecked()
182 RawTask::<_, F::Output, S>::allocate(future, schedule) in spawn_unchecked()
184 RawTask::<F, F::Output, S>::allocate(future, schedule) in spawn_unchecked()
226 /// let schedule = |runnable| QUEUE.send(runnable).unwrap();
227 /// let (runnable, task) = async_task::spawn(async { 1 + 2 }, schedule);
229 /// // Schedule the task and await its output.
230 /// runnable.schedule();
249 /// This is a convenience method that passes the [`Runnable`] to the schedule function.
256 /// let schedule = move |runnable| s.send(runnable).unwrap();
258 /// // Create a task with a simple future and the schedule function.
259 /// let (runnable, task) = async_task::spawn(async {}, schedule);
261 /// // Schedule the task.
263 /// runnable.schedule();
266 pub fn schedule(self) { in schedule() method
272 ((*header).vtable.schedule)(ptr); in schedule()
295 /// let schedule = move |runnable| s.send(runnable).unwrap();
297 /// // Create a task with a simple future and the schedule function.
298 /// let (runnable, task) = async_task::spawn(async { 1 + 2 }, schedule);
321 /// let schedule = move |runnable| s.send(runnable).unwrap();
323 /// // Create a task with a simple future and the schedule function.
324 /// let (runnable, task) = async_task::spawn(future::pending::<()>(), schedule);