Function async_task::spawn_unchecked[][src]

pub unsafe fn spawn_unchecked<F, S>(
    future: F,
    schedule: S
) -> (Runnable, Task<F::Output>) where
    F: Future,
    S: Fn(Runnable), 

Creates a new task without Send, Sync, and 'static bounds.

This function is same as spawn(), except it does not require Send, Sync, and 'static on future and schedule.

Safety requirements:

Examples

// The future inside the task.
let future = async {
    println!("Hello, world!");
};

// If the task gets woken up, it will be sent into this channel.
let (s, r) = flume::unbounded();
let schedule = move |runnable| s.send(runnable).unwrap();

// Create a task with the future and the schedule function.
let (runnable, task) = unsafe { async_task::spawn_unchecked(future, schedule) };