pub(super) fn prepare_tasks(
        &mut self,
        task_barrier: Arc<Barrier>,
        stop_receiver: StopReceiver,
    ) -> TaskReprs {
        let mut long_running_tasks = Vec::new();
        let mut oneshot_tasks = Vec::new();

        for task in std::mem::take(&mut self.tasks) {
            let name = task.id();
            let kind = task.kind();
            let stop_receiver = stop_receiver.clone();
            let task_barrier = task_barrier.clone();
            let task_future: BoxFuture<'static, _> =
                Box::pin(task.run_internal(stop_receiver, task_barrier));
            let named_future = NamedFuture::new(task_future, name);
            if kind.is_oneshot() {
                oneshot_tasks.push(named_future);
            } else {
                long_running_tasks.push(named_future);
            }
        }

        let only_oneshot_tasks = long_running_tasks.is_empty();
        // Create a system task that is cancellation-aware and will only exit on either oneshot task failure or
        // a stop request.
        let oneshot_runner_system_task =
            oneshot_runner_task(oneshot_tasks, stop_receiver, only_oneshot_tasks);
        long_running_tasks.push(oneshot_runner_system_task);

        TaskReprs {
            tasks: long_running_tasks,
            shutdown_hooks: std::mem::take(&mut self.shutdown_hooks),
        }
    }
Transforms the collection of tasks into a set of universal futures.
core/lib/node_framework/src/service/runnables.rs