pub fn spawn_local<T: 'static>(&self, future: impl Future<Output = T> + 'static) -> Task<T> {
        let local = self.local.clone();
        let callback = self.callback.clone();
        let id = thread_id();

        // The function that schedules a runnable task when it gets woken up.
        let schedule = move |runnable| {
            if thread_id() == id && WORKER.is_set() {
                WORKER.with(|w| {
                    if Arc::ptr_eq(&local, &w.local) {
                        w.local.push(runnable).unwrap();
                    } else {
                        local.push(runnable).unwrap();
                    }
                });
            } else {
                local.push(runnable).unwrap();
            }

            callback.call();
        };

        // Create a task, push it into the queue by scheduling it, and return its `Task` handle.
        let (runnable, handle) = async_task::spawn_local(future, schedule, ());
        runnable.schedule();
        Task(Some(handle))
    }
/// Spawns a thread-local future onto this executor.
///
/// Returns a [`Task`] handle for the spawned future.
Spawns a thread-local future onto this executor.
Returns a [`Task`] handle for the spawned future.
Spawns a thread - local future onto this executor . Returns a [ ` Task ` ] handle for the spawned future .
pub fn spawn_local<T: 'static>(&self, future: impl Future<Output = T> + 'static) -> Task<T> {
        let local = self.local.clone();
        let callback = self.callback.clone();
        let id = thread_id();
        // The function that schedules a runnable task when it gets woken up.
        let schedule = move |runnable| {
            if thread_id() == id && WORKER.is_set() {
                WORKER.with(|w| {
                    if Arc::ptr_eq(&local, &w.local) {
                        w.local.push(runnable).unwrap();
                    } else {
                        local.push(runnable).unwrap();
                    }
                });
            } else {
                local.push(runnable).unwrap();
            }
            callback.call();
        };
        // Create a task, push it into the queue by scheduling it, and return its `Task` handle.
        let (runnable, handle) = async_task::spawn_local(future, schedule, ());
        runnable.schedule();
        Task(Some(handle))
    }
pub fn spawn_local < T : ' static > ( & self , future : impl Future < Output = T > + ' static ) -> Task < T > { let local = self . local . clone ( ) ; let callback = self . callback . clone ( ) ; let id = thread_id ( ) ; // The function that schedules a runnable task when it gets woken up. let schedule = move | runnable | { if thread_id ( ) == id && WORKER . is_set ( ) { WORKER . with ( | w | { if Arc :: ptr_eq ( & local , & w . local ) { w . local . push ( runnable ) . unwrap ( ) ; } else { local . push ( runnable ) . unwrap ( ) ; } } ) ; } else { local . push ( runnable ) . unwrap ( ) ; } callback . call ( ) ; } ; // Create a task, push it into the queue by scheduling it, and return its `Task` handle. let ( runnable , handle ) = async_task :: spawn_local ( future , schedule , ( ) ) ; runnable . schedule ( ) ; Task ( Some ( handle ) ) }
Spawns a thread-local future onto this executor.
Spawns a thread - local future onto this executor .
&self
future
impl Future<Output = T> + 'static