fn cleanup() {
        // A slightly delicate dance here: we need to drop the tasks from outside of `Self::with`,
        // because a task's Drop impl might want to call back into `ExecutionState` (to check
        // `should_stop()`). So we pull the tasks out of the `ExecutionState`, leaving it in an
        // invalid state, but no one should still be accessing the tasks anyway.
        let (mut tasks, final_state) = Self::with(|state| {
            assert!(state.current_task == ScheduledTask::Stopped || state.current_task == ScheduledTask::Finished);
            (std::mem::replace(&mut state.tasks, SmallVec::new()), state.current_task)
        });

        for task in tasks.drain(..) {
            assert!(
                final_state == ScheduledTask::Stopped || task.finished(),
                "execution finished but task is not"
            );
            Rc::try_unwrap(task.continuation)
                .map_err(|_| ())
                .expect("couldn't cleanup a future");
        }

        #[cfg(debug_assertions)]
        Self::with(|state| state.has_cleaned_up = true);
    }
/// Prepare this ExecutionState to be dropped. Call this before dropping so that the tasks have
/// a chance to run their drop handlers while `EXECUTION_STATE` is still in scope.
Prepare this ExecutionState to be dropped. Call this before dropping so that the tasks have
a chance to run their drop handlers while `EXECUTION_STATE` is still in scope.
Prepare this ExecutionState to be dropped . Call this before dropping so that the tasks have a chance to run their drop handlers while ` EXECUTION_STATE ` is still in scope .
fn cleanup() {
        // A slightly delicate dance here: we need to drop the tasks from outside of `Self::with`,
        // because a task's Drop impl might want to call back into `ExecutionState` (to check
        // `should_stop()`). So we pull the tasks out of the `ExecutionState`, leaving it in an
        // invalid state, but no one should still be accessing the tasks anyway.
        let (mut tasks, final_state) = Self::with(|state| {
            assert!(state.current_task == ScheduledTask::Stopped || state.current_task == ScheduledTask::Finished);
            (std::mem::replace(&mut state.tasks, SmallVec::new()), state.current_task)
        });
        for task in tasks.drain(..) {
            assert!(
                final_state == ScheduledTask::Stopped || task.finished(),
                "execution finished but task is not"
            );
            Rc::try_unwrap(task.continuation)
                .map_err(|_| ())
                .expect("couldn't cleanup a future");
        }
        #[cfg(debug_assertions)]
        Self::with(|state| state.has_cleaned_up = true);
    }
fn cleanup ( ) { // A slightly delicate dance here: we need to drop the tasks from outside of `Self::with`, // because a task's Drop impl might want to call back into `ExecutionState` (to check // `should_stop()`). So we pull the tasks out of the `ExecutionState`, leaving it in an // invalid state, but no one should still be accessing the tasks anyway. let ( mut tasks , final_state ) = Self :: with ( | state | { assert ! ( state current_task ScheduledTask Stopped state current_task ScheduledTask Finished ) ; ( std :: mem :: replace ( & mut state . tasks , SmallVec :: new ( ) ) , state . current_task ) } ) ; for task in tasks . drain ( .. ) { assert ! ( final_state ScheduledTask Stopped task finished ( ) " " ) ; Rc :: try_unwrap ( task . continuation ) . map_err ( | _ | ( ) ) . expect ( " " ) ; } # [ cfg ( debug_assertions ) ] Self :: with ( | state | state . has_cleaned_up = true ) ; }
Prepare this ExecutionState to be dropped.
Prepare this ExecutionState to be dropped .