bevy_coroutine 0.4.0

A simple library to run coroutines in Bevy
Documentation
use bevy::prelude::*;
use bevy::app::ScheduleRunnerPlugin;
use bevy_coroutine::prelude::*;

fn main()
{
	App::new()
		.add_plugins((
			ScheduleRunnerPlugin::default(),
			CoroutinePlugin,
		))
		.add_systems(Startup, run_coroutines)
		.run();
}

fn run_coroutines(
	mut commands: Commands
)
{
	// Run two coroutine in parallel using the same system
	commands.queue(Coroutine::new((print_numbers, stop_app)));
}

// Prints numbers from 0 to 3, printing a single number each update
fn print_numbers(
) -> CoResult
{
	let mut res = co_break();
	for i in 0..=3
	{
		res.add_subroutines(with_input(i, print_number));
	}

	res
}

fn print_number(
	In(i): In<u32>,
) -> CoResult
{
	println!("{i}");

	co_break()
}

fn stop_app(mut exit: MessageWriter<AppExit>) -> CoResult
{
	exit.write(AppExit::Success);
	co_break()
}