not-elm
bevy_flurx
Rust

Allows you to use coroutine in Bevy

Last updated Mar 30, 2026
79
Stars
1
Forks
2
Issues
0
Stars/day
Attention Score
29
Language breakdown
Rust 100.0%
β–Έ Files click to expand
README

bevy_flurx

Crates.io MIT/Apache 2.0 Crates.io

[!TIP]
Supports no_std

This library provides functionality similar to coroutines, allowing you to write sequential processing for delays, user input, animations, and more.

Reactor can be used incrementally, meaning there’s no need to rewrite existing applications to incorporate it.

//! Here are some basic [once], [wait], [delay], [then], [pipe] and [through] actions.
//!
//! For details on all actions, please check here.
//!
//! [once]: https://docs.rs/bevyflurx/latest/bevyflurx/action/once/index.html
//! [wait]: https://docs.rs/bevyflurx/latest/bevyflurx/action/wait/index.html
//! [delay]: https://docs.rs/bevyflurx/latest/bevyflurx/action/delay/index.html
//! [then]: https://docs.rs/bevyflurx/latest/bevyflurx/action/sequence/trait.Then.html#tymethod.then
//! [pipe]: https://docs.rs/bevyflurx/latest/bevyflurx/action/pipe/trait.Pipe.html#tymethod.pipe
//! [through]: https://docs.rs/bevyflurx/latest/bevyflurx/action/through/fn.through.html

use bevy::prelude::*; use bevy_flurx::prelude::*; use core::time::Duration;

fn main() { App::new() .insert_resource(Count(0)) .add_plugins(( DefaultPlugins, FlurxPlugin, )) .addsystems(Startup, spawnreactor) .run(); }

#[derive(Resource)] struct Count(usize);

fn spawn_reactor(mut commands: Commands) { commands.spawn(Reactor::schedule(|task| async move { // once module defines the actions that runs only once. // For example, once::run once executes any system. // other once actions: https://docs.rs/bevyflurx/latest/bevyflurx/action/once/index.html let current_count: usize = task.will(Update, once::run(|mut count: ResMut<Count>| { count.0 += 1; count.0 })).await; asserteq!(currentcount, 1);

// ActionSeed and Action have input and output the generic types. // You can call ActionSeed::with(&lt;input&gt;) to pass the input to action seed. let result: usize = task.will(Update, once::run(|In(num): In<usize>| { num + 3 }).with(3)).await; assert_eq!(result, 6);

// The wait module defines actions that continue to execute every frame according to specified conditions. // For example, wait::until takes a system that returns a bool value and continues to execute it until it returns true. // other wait actions: https://docs.rs/bevyflurx/latest/bevyflurx/action/wait/index.html task.will(Update, wait::until(|mut count: ResMut<Count>| { count.0 += 1; info!("current count: {}", count.0); count.0 == 4 })).await;

// delay module defines the actions that perform delay processing. task.will(Update, delay::time().with(core::time::Duration::from_secs(1))).await;

// then, pipe and through are also actions that continues to execute another action. let message = task.will(Update, { delay::frames().with(30) .then(once::run(|count: Res&lt;Count&gt;| { count.0 })) // Pipes the output of an action to the input of the next action. .pipe(once::run(|In(count): In&lt;usize&gt;| { format!(&quot;count is {count}&quot;) })) // Executes the next while keeping the output of the previous action. .through(delay::time().with(Duration::from_secs(1))) }).await; assert_eq!(message, &quot;count is 4&quot;);

info!(&quot;Done!&quot;); task.will(Update, once::message::appexitsuccess()).await; })); }</code></pre>

Documents

Example

All examples are here.

Feature flags

| flag name | short description | default | |-------------|------------------------------------------------------------------------------------|---------| | audio | audio actions | false | | record | undo/redo actions and events | false | | side-effect | thread/async side effects | false | | state | state actions | false | | tokio | allows to use write asynchronous functions depend on tokio directly in the reactor | false | | std | enable features that depend on the standard library | false | | serialize | derives ReflectSerialize and ReflectDeserialize for some structs | false |

audio

Provides the actions that perform simple audio playback and waiting using bevy's default audio functionality.

record

doc.rs

Provides Record to manage operation history.

side-effect

doc.rs

Allows to convert the operations with side effects such as asynchronous runtime or thread into the referential-transparent actions.

tokio

You will be able to write processes that depend on tokio's runtime in the reactor.

std

Both side-effect and std flags must be enabled to use side_effect::thread`.

ChangeLog

Please see here.

Compatible Bevy versions

| bevy_flurx | bevy | |------------|------| | 0.14.0 ~ | 0.18 | | 0.13.0 ~ | 0.17 | | 0.11 ~ | 0.16 | | 0.7.0 ~ | 0.15 | | 0.6.0 ~ | 0.14 | | 0.3.0 ~ | 0.13 |

Credits

Using bevygame_template to CI.

License

This crate is licensed under the MIT License or the Apache License 2.0.

πŸ”— More in this category

Β© 2026 GitRepoTrend Β· not-elm/bevy_flurx Β· Updated daily from GitHub